Variable length encoding method and variable length decoding method

ABSTRACT

The invention enables the accurate detection of the focal length for focusing by using color data. An image processing circuit ( 15 ) generates image data representing brightness and each of the colors of R (red), G (green) and B (Blue). Either automatically or in response to operation by the photographer, image data to be used for focusing is selected from the image data representing the brightness and the respective colors, and the amount of the weight for each respective image data is set. A plurality of images are photographed while the optical system ( 11 ) is driven to change its focal length. A focal length is calculated for each selected image data. Weight is applied to each one of the calculated focal lengths so as to calculate a final focal length. As the use of the image data of an appropriate color enables the range finding for a subject, the distance to which cannot be measured solely from brightness, the present invention not only ensures accurate measurement of the distance for focusing but also enables the reduction of types of subjects that present difficulties in focus control. In addition, capturing images at focal lengths that have been respectively detected by using color data of a plurality of colors (i.e. bracket photography) increases the possibility of focusing on a subject which is characterized by specific color data. Therefore, the possibility of capturing an image for which the lens is correctly focused for a subject on which the photographer intends to focus is increased.

TECHNICAL FIELD

The present invention relates to a focal length detecting method, afocusing device, an image capturing method and an image capturingapparatus for detecting a focal length based on image data.

BACKGROUND OF THE INVENTION

In some conventional image capturing apparatuses, such as video camerasand electronic still cameras, focusing a lens calls for extracting ahigh-frequency component from data of a captured image. To be morespecific, the focusing process comprises steps of capturing an imagewhile driving the lens to move its focal point and extracthigh-frequency components respectively at various positions of the lens,calculating evaluated value of contrast (such a value is hereinafterreferred to as contrast) based on the extracted high-frequencycomponents, and moving the lens in such a direction as to increase thecontrast. The position where the contrast is at the maximum is regardedas the focusing position of the lens.

A conventionally known example of such constitution is described inJapanese Laid-open Patent Publication No. 02-214272, which offers adevice that uses a high frequency component in a brightness signal. Theaforementioned device has a constitution such that when a targetedsubject is a person, the device aims at reliable focusing on the subjectby using a color differential signal to detect a skin color part fromimage data and increasing the weighting of the high frequency componentin the brightness signal for the skin color part.

As shown in Japanese Laid-open Patent Publication No. 04-150692, anotherexample of conventional art is provided with a circuit for detecting askin color part from image signals and is adapted to function such thatwhen a subject contains a skin color, on which the lens is focused,exposure is controlled so that the appropriate exposure is achieved forthe skin color part. The device has such a constitution as to detect acorrectly focused state based on whether the high frequency component ina brightness signal has reached a given level.

As shown in Japanese Laid-open Patent Publication No. 05-53041, yetanother example of conventional art calls for detecting a skin colorpart from image signals to judge whether the principal subject is aperson, and, when the principal subject has been ascertained to be aperson, setting the lens driving speed for automatic focusing at a lowspeed in order to stop the lens with high precision.

Conventionally known methods of photography include what is commonlycalled bracket photography, which is a photographing method forsuccessively capturing multiple image data with a single photographingaction so as to ensure that the photographer captures the subject thathe intends. There are various examples of conventional bracketphotography, including one that uses a plurality of white balances whenperforming photographing, focus bracket photography for capturing imagesat a plurality of focal lengths, and exposure bracket photography forchanging exposure towards the plus side and the minus side, with theexposure that is judged to be appropriate in the middle.

An example of bracket photography based on white balance is described inJapanese Patent Publication No. 3332396, which offers a constitutionthat calls for dividing a photography screen into a plurality ofdivision fields and capturing images with white balances respectivelyset for these division fields.

An example of focus bracket photography is described in JapaneseLaid-open Patent Publication No. 2001-116979, which offers aconstitution that calls for measuring the distance to each one of aplurality of subjects present in a photographic range and performingphotographing at each focus position. According to this constitution,the distances to a plurality of subjects are measured by detecting peakpositions of evaluated values of high frequency components while movingthe lens or measuring a subject distance in each range finding area.

SUMMARY OF THE INVENTION

As described above, a constitution that takes not of a skin color partis effective only for photographing of a human subject. Furthermore,human skin usually presents low contrast, which often causes erroneousdetection of a focal length, particularly when there is some otherobject having a color similar to the human skin color. In other words, aconstitution described in any one of the relevant patent documentsmentioned above relates to focusing based on a single kind ofinformation, i.e. either brightness data or information similar tobrightness data, and enables accurate focusing only under specificconditions.

Focus bracket photography increases the possibility of correct focusingon a targeted subject. However, should the brightness data of a targetedsubject have low contrast, there is the possibility of a failure tofocus on the targeted subject, because the contrast in the brightnessdata may not be detected as a peak of the evaluated values of the highfrequency components or as a subject in a range finding area.

In order to solve the above problems, an object of the present inventionis to provide a focal length detecting method and a focusing devicewhich are capable of accurate detection of a focal length in response tovarious types of subjects or photographing conditions. Another object ofthe present invention is to provide an image capturing method and animage capturing apparatus which present a greater possibility ofcapturing an image for which the lens is correctly focused for a subjecton which the photographer intends to focus.

A method of detecting a focal length according to the present inventioncalls for obtaining, while changing the focal length of an opticalsystem, multiple image data selected from among image data consisting ofbrightness data and a plurality of color data, and calculating a focallength from the obtained multiple image data by using the peak value ofcontrast evaluated values of said multiple image data.

As the focal length is calculated based on the image data that isselected from brightness data and a plurality of color data and containsthe information appropriate for contrast detection, the focal length toa subject containing various color data can be correctly detected invarious photographing conditions.

According to the invention, weighting of the evaluated values of eachimage data of each respective color data that has been selected isautomatically performed based on conditions set for said each imagedata.

By automatic weighting of the evaluated values, correct detection of thefocal length can be easily performed.

According to the invention, the operator performs by the operator'sdiscretion weighting of the evaluated values of each image data of eachrespective color data that has been selected.

With the feature described above, the focal length to a subject that isof a specific color or has other similar conditions can be accuratelyand easily detected in accordance with the operator's intention.

According to the invention, a photographing mode for calculating a focallength by using only image data that consists of color data of aspecific color selected based on a subject is provided.

Therefore, using only the image data that consists of the color data ofa specific color ensures easy focusing for a subject on which theoperator intends to focus on without being affected by other color data.

According to the invention, auxiliary light with given color data isemitted when the image data is obtained, and weighting of the evaluatedvalues of the color image data is performed based on the color data ofthe emitted auxiliary light.

With the feature described above, by emitting auxiliary light that isappropriate to detect contrast and performing weighting of the evaluatedvalues of the color image data based on the color data of the emittedauxiliary light, accurate detection of the focal length is ensured whilemaking effective use of the auxiliary light.

According to the invention, the method calls for setting a plurality ofimage detecting areas adjacent to one another in each one of theobtained multiple image data, calculating a partial focal length foreach image detecting area based on which image data the peak value ofcontrast evaluated values has been recorded in, calculating thereliability of each image detecting area based on the position at whichsaid peak value has been recorded moving across the multiple image data,and selecting a focal length from a group consisting of said partialfocal lengths and at least one given focal length, said focal lengthselected based on the reliability and the evaluated values of eachrespective image detecting area.

As each reliability is calculated based on the position at which thepeak value of the contrast evaluated values has been recorded movingacross the multiple image data so that the partial focal length of animage detecting area that has a low reliability due to relative movementof the subject is excluded from selection, the method described aboveenables the accurate detection of the focal length.

A focusing device according to the invention includes an image pickupdevice, an optical system for forming an image on the image pickupdevice, an optical system driving means for changing the focal length ofthe optical system, and an image processing means for processing imagedata output from the image pickup device and controlling the opticalsystem driving means, wherein the image processing means is adapted toobtain, while changing the focal length of the optical system, multipleimage data selected from among image data of brightness data and aplurality of color data, and calculate a focal length from the obtainedmultiple image data by using the peak value of contrast evaluated valuesof said multiple image data.

As the focal length is calculated based on the image data that isselected from brightness data and a plurality of color data and containsthe information appropriate for contrast detection, accurate focusingfor a subject containing various color data can be ensured in variousphotographing conditions.

According to the invention, the focusing device is provided with anoperating means which enables the operator to perform by the operator'sdiscretion weighting of the evaluated values of each image data of eachrespective color data that has been selected.

With the feature described above, accurate focusing for a subject thatis of a specific color or has other similar conditions can be ensured inaccordance with the operator's intention.

According to the invention, the image processing means is adapted toautomatically perform weighting of the evaluated values of each imagedata of each respective color data that has been selected based onconditions set for said each image data.

By automatic weighting of the evaluated values, accurate focusing isensured.

According to the invention, the focusing device is provided with anauxiliary light device for emitting light with given color data.

The device having this constitution enables the accurate focusing byeffectively using auxiliary light.

According to the invention, the image processing means is adapted to seta plurality of image detecting areas adjacent to one another in each oneof the obtained multiple image data, calculate a partial focal lengthfor each image detecting area based on which image data the peak valueof contrast evaluated values has been recorded in, calculate thereliability of each image detecting area based on the position at whichsaid peak value has been recorded moving across the multiple image data,and select a focal length from a group consisting of said partial focallengths and at least one given focal length, said focal length selectedbased on the reliability and the evaluated values of each respectiveimage detecting area.

As each reliability is calculated based on the position at which thepeak value of the contrast evaluated values has been recorded movingacross the multiple image data so that the partial focal length of animage detecting area that has a low reliability due to relative movementof the subject is excluded from selection, the method described aboveenables the accurate focusing.

An image capturing method according to the invention calls for usingcolor data of a plurality of colors to detect a focal length for eachrespective color data and capturing an image at each focal lengthdetected for each respective color data.

With the feature described above, capturing images at focal lengths thathave been respectively detected by using color data of a plurality ofcolors increases the possibility of focusing on a subject which ischaracterized by specific color data. Therefore, the possibility ofcapturing an image for which the lens is correctly focused for a subjecton which the photographer intends to focus is increased.

According to the invention, a plurality of photographing modes can beselected, and, should a plurality of photographing modes besimultaneously selected, focal lengths are detected for each one of theselected photographing modes by using color data of a plurality ofcolors, and images are captured at the respected focal lengths that havebeen detected.

With the feature described above, capturing images at focal lengths thathave been respectively detected by using color data of a plurality ofcolors for each one of the selected photographing modes increases thepossibility of focusing on a subject which is characterized by specificcolor data. Therefore, the possibility of capturing an image for whichthe lens is correctly focused for a subject on which the photographerintends to focus is increased.

According to the invention, focal length detection calls for obtaining aplurality of image data of each respective color data while changing thefocal length of an optical system, setting a plurality of imagedetecting areas adjacent to one another for the image data of each colordata, calculating a partial focal length for each image detecting areabased on which image data the peak value of contrast evaluated valueshas been recorded in, calculating the reliability of each imagedetecting area based on the position at which said peak value has beenrecorded moving across the multiple image data, and selecting a focallength from a group consisting of said partial focal lengths and atleast one given focal length, said focal length selected based on thereliability and the evaluated values of each respective image detectingarea.

As each reliability is calculated based on the position at which thepeak value of the contrast evaluated values has been recorded movingacross the multiple image data so that the partial focal length of animage detecting area that has a low reliability due to relative movementof the subject is excluded from selection, the method described aboveenables the accurate detection of the focal length for each respectivecolor data.

An image capturing apparatus according to the invention includes animage pickup device, an optical system for forming an image on the imagepickup device, an optical system driving means for changing the focallength of the optical system, and an image processing means forprocessing image data output from the image pickup device andcontrolling the optical system driving means, wherein the imageprocessing means is adapted to obtain a plurality of image data of eachrespective color data while changing the focal length of the opticalsystem, calculate a focal length for each respective color datamentioned above by using the peak value of contrast evaluated valuescalculated from the obtained multiple image data, and perform imagecapturing at each focal length calculated for each respective colordata.

With the feature described above, capturing images at focal lengths thathave been respectively detected by using color data of a plurality ofcolors increases the possibility of focusing on a subject which ischaracterized by specific color data. Therefore, the possibility ofcapturing an image for which the lens is correctly focused for a subjecton which the photographer intends to focus is increased.

According to the invention, the apparatus is provided with a warningmeans for indicating that image capturing is underway.

An image capturing apparatus having the feature described above iscapable of warn the photographer not to move the image capturingapparatus away from the subject when capturing a plurality of images insequence.

By calculating the focal length using the selected image data thatcontains the information appropriate for contrast detection, the presentinvention enables the accurate detection of a focal length in responseto various types of subjects or photographing conditions. Furthermore,capturing images at focal lengths that have been respectively detectedby using color data of a plurality of colors increases the possibilityof focusing on a subject which is characterized by specific color data.Therefore, the possibility of capturing an image for which the lens iscorrectly focused for a subject on which the photographer intends tofocus is increased. Therefore, the possibility of capturing an image forwhich the lens is correctly focused for a subject on which thephotographer intends to focus is increased.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a focusing device according to anembodiment of the present invention.

FIG. 2 is a schematic illustration to explain in detail an imageprocessing circuit of said focusing device.

FIG. 3 is a schematic illustration to explain the function of saidfocusing device in the state that there is no blur, wherein (a) is aschematic illustration of the relationship between windows and asubject, and (b) is a schematic illustration of a change in contrastevaluated values.

FIG. 4 is a schematic illustration of the relationship between thewindows of said focusing device and the subject in a situation wherethere is blur.

FIG. 5 is a schematic illustration to explain the function of saidfocusing device in a situation where there is blur, wherein (a) is aschematic illustration of the relationship between the windows and thesubject, and (b) is a schematic illustration of a change in evaluatedvalues of contrast of the windows W4,W5.

FIG. 6 is a schematic illustration of the relationship between thewindows of said focusing device and the subject in a situation wherethere is blur.

FIG. 7 is a flow chart showing the function of said focusing device.

FIG. 8 is a flow chart showing how said focusing device calculates thenumber of data images to be obtained.

FIG. 9 is a flow chart showing how said focusing device performsweighting.

FIG. 10 is a flow chart showing how said focusing device calculates afocusing distance.

FIG. 11 is a flow chart showing the function of a focusing deviceaccording to the present invention.

FIG. 12 is a flow chart showing the function of said focusing device.

FIG. 13 is a flow chart showing the function of said focusing device.

FIG. 14 is a flow chart showing the function of said focusing device.

FIG. 15 is a flow chart showing the function of said focusing device.

FIG. 16 is a flow chart showing how said focusing device calculates afocusing distance.

FIG. 17 is a flow chart showing the function of an image capturingapparatus according to another embodiment of the present invention.

FIG. 18 is a flow chart showing the function of said image capturingapparatus.

FIG. 19 is a flow chart showing the function of said image capturingapparatus.

DETAILED DESCRIPTION OF THE INVENTION

A focal length detecting method, a focusing device, an image capturingmethod and an image capturing apparatus according to the presentinvention are explained hereunder, referring to relevant drawings.

Referring to FIG. 1, numeral 10 denotes an image capturing apparatus,which is a digital camera for capturing still images and moving imagesand provided with a focusing device. The image capturing apparatus 10 isprovided with an optical system 11 comprised of lenses, an aperture,etc., a CCD 12 as an image pickup device, an analog circuit 13 intowhich signals output from the CCD 12 shall be sequentially input, an A/Dconverter 14, an image processing circuit 15 serving as both aninformation selecting means and an image processing means, a memory 16which is a RAM or the like and serves as a recording means, a CPU 17having a function of a control means that serves as an image processingmeans, a CCD driving circuit 18 adapted to be controlled by the CPU 17so as to drive the CCD 12, a motor driving circuit 19 serving as anoptical system driving means that is adapted to be controlled by the CPU17, a motor 20 serving as an optical system driving means, a liquidcrystal display or the like serving as an image display unit 21 whichalso functions as a warning means, a memory card or the like serving asan image recording medium 22, an auxiliary light device 23 serving as aninformation selecting means, and other components that are not shown inthe drawings, including a housing, a power supply unit, input and outputterminals, and operating means such as a shutter button, switches, aphotographing mode selecting means, etc. The aforementioned motor 20 isadapted to be driven by the motor driving circuit 19 so as to change thefocal length by moving back and forth a lens of the optical system 11,e.g. a focus lens.

The CCD 12 is a CCD-type solid-state image pickup device, which is animage sensor using a charge-coupled device. The CPU 17 is what iscommonly called a microprocessor and controls the entire system.According to the present embodiment, the CPU 17 controls the apertureand focus, i.e. focal length, of the optical system 11. The CPU 17performs the focus control by causing through the motor driving circuit19 the motor 20 to drive the optical system 11 so as to move a single ora plurality of focus lenses back and forth. Other functions of the CPU17 include control of driving of the CCD 12, which is performed throughcontrol of the CCD driving circuit 18, control of such circuits as theanalog circuit 13 and the image processing circuit 15, processing datato be recorded to the memory 16, control of the image display unit 21,recording/reading of image data to or from the image recording medium22, and emitting auxiliary light by means of the auxiliary light device23. The memory 16 consists of an inexpensive DRAM or the like and isused by a plurality of components; it is where the CPU 17 runs programs,the CPU 17 and the image processing circuit 15 perform their respectivework, input/output to and from the image recording medium 22 isbuffered, and it is where other image data is temporarily stored.

The CPU 17 controls the aperture and other relevant parts of the opticalsystem 11 to adjust the intensity of the light off subject that strikesthe CCD 12. The CCD 12 is driven by the CCD driving circuit 18 so thatan analog image signal resulting from photo-electric conversion of thelight off subject is output from the CCD 12 to the analog circuit 13.The CPU 17 also serves to control an electronic shutter of the CCD 12through the CCD driving circuit 18. The analog circuit 13 consists of acorrelated double sampling means and a gain control amplifier andfunctions to remove noises or amplify analog image signals output fromthe CCD 12. The CPU 17 controls the degree of amplification by the gaincontrol amplifier of the analog circuit 13 or other functions of theanalog circuit 13.

The output signals from the analog circuit 13 are input into the A/Dconverter 14, by which they are converted into digital signals. Theimage signals thus converted into digital signals are either input intothe image processing circuit 15 or temporarily stored directly in thememory 16 for later processing. Image signals that have been input inthe image processing circuit 15 undergo image processing and then outputinto the memory 16, and they are subsequently either displayed on theimage display unit 21 or, depending on operation by the user, recordedin the image recording medium 22 as a moving image or a still image. Theunprocessed image data that has temporarily been stored in the memory 16is processed by either one of or both the CPU 17 and image processingcircuit 15.

As shown in FIG. 2, the image processing circuit 15 according to thepresent embodiment includes a matrix complementary circuit 27, a switch28, an area determining circuit 31, filter circuits 32 serving as acontrast detecting means, a peak determining circuit 33, a peak positiondetermining circuit 34, and an arithmetic circuit 35.

At a given lens position, in other words in the state where the opticalsystem 11 is set at an appropriate focal length, an image of a subjectentering the optical system 11 is converted into analog image signalsthrough the CCD 12 and then into digital image data through the analogcircuit 13 and the A/D converter 14. The digital image data output fromthe A/D converter 14 is stored in the memory 16. At the same time, theimage processing circuit 15 process the digital image data in order tocontrol focusing, exposure and other necessary operations. To be morespecific, the image data converted into digital image data by the A/Dconverter 14 is input into the matrix complementary circuit 27, whichperforms color conversion or complementary processing of the data andoutputs image data for focus control or exposure control as YCCbrightness data (hereinafter referred to as brightness data) and RGBsignal data (hereinafter referred to as color data). Various settingsfor these conversions may be changed by the CPU 17 in accordance with aprogram. The aforementioned brightness data and color data output fromthe matrix complementary circuit 27 are input into the switch 28, whichis adapted to be controlled by the CPU 17. The brightness data and thecolor data input into the switch 28 are selected as image data forcontrol based on various photographing conditions or other criteria andoutput from the switch 28. The image processing circuit 15 is thus ableto output image data as RGB image data consisting of red signals (R),green signals (G) and blue signals (B), in addition to image datarepresenting normal YCC brightness data.

The image data output from the switch 28 is input into the areadetermining circuit 31, which applies the image data area determiningprocessing in order to determine an image focusing area W shown in FIG.3 and other drawings. The image focusing area W is an image area usedfor focusing and has a plurality of image detecting areas Wh. In thecase of the present embodiment, the image detecting areas Wh consist ofwindows W1-W9. The explanation hereunder is given based on theassumption that there is provided a means to calculate a distance fromthe optical system 11 to a subject T (such a distance is hereinafterreferred to as the subject distance) in the windows W1-W9, in otherwords in the range that covers plural parts of the subject T. To be morespecific, in order to determine whether the contrast is high or low ineach window W1-W9 of the image focusing area W, the filter circuits 32analyze high frequency components to calculate the contrast evaluatedvalue for each window W1-W9. High-pass filters (HPF), which have arelatively high contrast, may desirably be used for the filter circuits32.

According to the present embodiment, an image on each window W1-W9 isprocessed. To be more specific, the peak determining circuit 33determines the highest value of the evaluated values that have beencalculated by the filter circuits 32, each of which is adapted toprocess each respective horizontal line of each window W1-W9. The peakdetermining circuit 33 outputs said highest value as the evaluated valuefor each respective window W1-W9. The position of a highest value onimage data, which value has been determined by the peak determiningcircuit 33, is called a peak position. Each peak position is calculatedby the peak position determining circuit 34 from the starting point ofeach respective window W1-W9 currently undergoing calculation. Outputsfrom the peak determining circuit 33 and the peak position determiningcircuit 34, in other words the peak values of the contrast evaluatedvalues of the respective horizontal lines in the windows W1-W9 and thepeak positions at which the peak values have been recorded, aretemporarily stored in the memory 16.

The peak values and peak positions calculated for the horizontal linesof the CCD 12 are summed up by the arithmetic circuit 35 in each windowW1-W9 so that the summed peak value and the summed peak position of eachwindow W1-W9 are output as the value of each window W1-W9 from thearithmetic circuit 35 to the CPU 17. The aforementioned “summed peakposition” means the average position with respect to the horizontaldirection. The arithmetic circuit 35 is an adder which serves as acalculating means. For calculation of summed peak values of therespective windows W1-W9, the arithmetic circuit 35 may be adapted tocarry out calculation only for peak values higher than a given level.

The optical system 11 is driven to change the lens position within a setrange, i.e. the driving range, so that summed peak values and summedpeak positions are calculated at each lens position and stored in thememory 16. The aforementioned driving range, in other words the numberof images to be captured for focusing, may be set appropriately based onthe magnification of the lens, the photographing distance, variousphotographing conditions set by the photographer, etc. In case of ashort subject distance, such as when a calculated evaluated value ishigher than a given value, i.e. FVTHn shown in FIG. 3(b), the drivingrange may be reduced to shorten the duration of focusing.

The peak values of each window W1-W9 are compared within the drivingrange. When there is a peak in the peak values with respect to thedriving direction of the lens, it is regarded as the peak of thecorresponding window W1-W9.

As it can be surmised that focusing on the subject T can be accomplishedin the vicinity of said peak, a focal length surmised from the value ofthe peak is regarded as the partial focal length of each respectivewindow W1-W9.

The plural windows W1-W9 constitute the image focusing area W.Therefore, if there is a window where the subject T is moving near thepeak, there should be others where the subject T is captured with greatcertainty near the peaks of the windows without blur.

In other words, the partial focal lengths of the windows W1-W9 consistof those with a high reliability, i.e. valid values, and those with alow reliability, i.e. invalid values. Therefore, using results ofcalculation of the peak values and peak positions, the CPU 17 evaluatesthe reliability of each window W1-W9, in other words, it appliesweighting to the focusing position determining means.

For example, should the average of the peak positions of a window W1-W9be rapidly moving near the partial focal length of the window, or theaverage of the peak positions of a window W1-W9 that is horizontallyadjacent thereto be rapidly moving, it can be surmised that blur isoccurring due to movement of the subject T. In such a case, the weighton the first-mentioned window W1-W9 is reduced. When there is nosignificant change in the average of the peak positions, the weight isnot reduced, because it is judged that the subject T is not moving.

Should the peak position of a subject T in a window move into anotherwindow, the peak values and peak positions of the first-mentioned windowchange significantly. Therefore, the reliability of a window where thepeak value and peak position have changed significantly is reduced byreducing the weight on such a window so that the partial focal lengthsin which the subject T are captured are given priorities.

This embodiment calls for evaluating contrast peaks in the windows W1-W9with respect to the horizontal direction. Therefore, as long as there isa contrast peak of the subject T in a window W1-W9, the evaluated valuefor the window does not change regardless of movement of the subject T.

A fluctuation of peak positions of peak values occurring whenever thelens is moved usually means noises or the like, in other words theabsence of contrast in the pertinent window. If such is the case, it isdetermined that the subject T is not present in the window, and theweight on the window is reduced.

The amount of the weight may be set beforehand or calculated fromevaluated values of image data or other similar factors based on variousphotographing conditions, such as brightness data, lens magnification,etc.

The CPU 17 multiplies an evaluated value by a weight factor, therebyobtaining a weighted evaluated value of each respective window W1-W2.

Should the weighted evaluated value be less than a given value, the CPU17, which serves as a determining means, regards the evaluated value tobe invalid and does not use it thereafter.

By summing up weighted evaluated values at each lens driven position,the CPU 17 serving as a selecting means calculates a final focusingposition, where the contrast is at the maximum. To be more specific,when a calculated result of the evaluated values is input into the CPU17, the CPU 17 performs calculation by summing up the evaluated values,i.e. the summed peak values and the summed peak positions of the windowsW1-W9 with the position of the subject at the current lens position usedas an evaluated value. At that time, the center of gravity of the peakpositions can be found when the peak position is a value obtained bydividing the sum of the evaluated values by the number of vertical linesin each window W1-W9. After reducing the weight on the evaluated valuefor each window in which there is a great change in the center ofgravity or a horizontal window from which the center of gravity hasmoved to a corner of the window, the evaluated values for the windowsare summed up to produce a final evaluated value.

The CPU 17 selects as the focusing distance the shortest partial subjectdistance selected from among the evaluated values that have been judgedto be valid. To be more specific, based on the amount of theaforementioned final evaluated value, the CPU 17 commands movement ofthe lens of the optical system 11 to the position having the highestfinal evaluated value by means of the motor driving circuit 19 and themotor 20. Should there be no change in the final evaluated value, theCPU 17 outputs a command to stop the motor 20 through the motor drivingcircuit 19.

As weighting prevents error in selecting the peak due to blur of thesubject T, the subject T can be correctly captured by means ofcalculation of plural focal lengths using a plurality of areas withoutthe problem of erroneously picking up blur. Therefore, the methoddescribed above enables reliable selection of correct focusing positionby using automatic focusing that gives priority to a short range, whichis generally deemed effective.

The in-focus position of the lens constituting the optical system, i.e.the position at which the lens is focused at a given distance, changeswith respect to the range of photographing distance for which the lensis designed, depending on fluctuation resulting from the lensmagnification, a change resulting from a change in aperture, as well astemperature, position and other conditions of the lens barrel supportingthe lens. Therefore, taking into consideration the degree of changeresulting from changes in these various conditions in addition to thedriving range calculated from the range within which the lens isdesigned to be focused, the optical system 11 is provided withoverstroke ranges at the short-range end and the long-range endrespectively. An overstroke range is a range in which the lens ispermitted to move by the distance corresponding to the degree of change.Furthermore, the control means, which is comprised of the CPU 17 or thelike, is adapted to be capable of moving the lens into an overstrokearea.

For example, given that the total moving distance of the in-focusposition of the lens is 10 mm and that the maximum integrated value ofthe degree of change is 1 mm when the aforementioned designed range ofphotographing distance is 50 cm to infinity, a 1 mm overstroke range isprovided at each end, i.e. the short-range side and the long-range endso that the lens driving range, i.e. the total moving distance of thein-focus position of the lens, is set at 12 mm (10 mm+1 mm+1 mm). Bythus providing overstroke ranges and permitting to drive the lens to theoverstroke ranges, the designed range of photographing distance isensured.

In order to support focusing processing, the auxiliary light device 23is provided with a plurality of auxiliary light sources adapted to emitlight based on the brightness of a subject in low-light conditions, inother words when the subject is dark. In the case of the presentembodiment, the auxiliary light sources consist of two light sources ofdifferent colors, i.e. auxiliary light sources L1,L2. The auxiliarylight sources L1,L2 are respectively connected to light source circuits43,44, which are connected to the CPU 17 through a first switch 45 and asecond switch 46. The auxiliary light sources L1,L2 are adapted to becontrolled by the light source circuits 43,44 to emit lightrespectively. The functions of the CPU 17 include giving direction as towhether each auxiliary light source L1,L2 should emit light as well ascontrolling lighting timing. The CPU 17 controls the first switch 45 soas to switch control of the auxiliary light source between the twoauxiliary light sources L1,L2. The CPU 17 also controls the secondswitch 46 which determines whether or not to control the two auxiliarylight sources L1,L2 simultaneously.

The number of the auxiliary light sources L1,L2 are not limited to two;three or more auxiliary light sources, i.e. an N number of auxiliarylight sources L1, L2 . . . LN, may be used. The plurality of auxiliarylight sources L1, L2 . . . LN may emit light beams of different colorsor the same color. Furthermore, the auxiliary light sources L1, L2 . . .LN may be controlled independently, or, in an alternative structure, aplurality of auxiliary light sources L1, L2 . . . LN may be controlledin combination so as to simultaneously emit light beams of differentcolors, thereby emitting light of a color different from that emittedfrom a single light source.

Next, how automatic focusing is performed in the photographing modeaccording to the present embodiment is explained hereunder, referring toFIGS. 3 through 16.

The present embodiment enables the photographer to use color data andauxiliary light in addition to normal brightness data in order toestablish the lens position, in other words to achieve correct focusing.Furthermore, even if there is blur of the subject, the embodimentensures correct focusing by dividing the image data into a plurality ofwindows.

First, how a device having the configuration that calls for dividing animage data into a plurality of windows functions in cases where there isno camera shake or the like causing blur of the subject is explained,referring to FIG. 3.

As shown in FIG. 3(a), the present embodiment calls for the imagefocusing area W to be situated at the center of the CCD 12 and dividedinto a total of nine portions, i.e. three portions horizontally by threeportions vertically, so as to form windows W1-W9. However, the imagefocusing area W may consist of any appropriate number of windows,provided that each window is adjacent to a plurality of other imagedetecting areas. The subject T is positioned so that the windows W1-W9sufficiently capture its contrast when there is no significant blur ofthe subject.

A result of evaluation of contrast in the state shown in FIG. 3(a) isrepresented by a curve Tc shown in FIG. 3(b). The example shown in FIG.3(b) represents the final evaluated value resulting from summing up theevaluated values produced by evaluating multiple image data obtained bycapturing the subject T with the optical system 11, which is driven bythe motor 20 to move its focus from the short range (“NEAR”) to the longrange (“FAR). FIG. 3(b) clearly shows that the subject distance Td is atthe peak P of the evaluated values.

Next, the automatic focusing function in cases where there is blur ofthe subject due to camera shake or other causes is explained hereunder,referring to FIGS. 4 through 6.

First, referring to FIG. 4, an explanation is given of how a method thatuses a plurality of image detecting areas copes with blur caused bycamera shake, movement of the subject, or other similar causes.

FIG. 4 illustrates camera shake during automatic focusing, i.e. asituation where the image capturing apparatus 10 inadvertently movesrelative to the subject T by showing images for focusing obtained byinputting image data while shifting the position of the lens of theoptical system 11 in the process from a scene S(H−1) through a sceneS(H) to a scene S(H+1) in time sequence. FIG. 4 shows as an example acase where a subject T is in the window W1 in the scene S(H−1). Uponoccurrence of movement of the subject or camera shake, the part of thesubject T with a large contrast moves to the window W5 in the scene S(H)and to the window W9 in the scene S(H+1). Therefore, should the contrastevaluated value be evaluated using only a specific window, e.g. thewindow W1, in this state, accurate evaluation cannot be performed.

FIG. 5, too, illustrates a situation where camera shake occurs duringautomatic focusing. FIG. 5(a) shows an image focusing area W which issimilar to the one shown in FIG. 3(a). In the image focusing area Wshown in FIG. 5(a), however, the subject T appears to move from theposition represented by the broken line T4 to the position representedby the solid line T5, thereby generating blur in which there appears tobe movement, for example, relative to the windows W4,W5 on the part ofthe subject T with a large contrast from the window W4 to the window W5.Should focusing be performed by driving the lens of the optical system11 during this movement of the subject T from the window W4 to thewindow W5, the evaluated value resulting from evaluation of the contrastof the window W4 and the evaluated value resulting from evaluation ofthe contrast of the window W5 are respectively represented by the curveTc4 and the curve Tc5 as shown in FIG. 5(b). Now, let us take as anexample the curve Tc4, which is the evaluated value for the window W4;the position Td4, which does not correspond to the actual subjectdistance Td serves as the peak P4 of the evaluated values, and employingthe peak P4 may impair discrimination of a plurality of subjects locatedat different distances or cause other errors.

A peak position that appears to move in the windows W1-W9 is shown inFIG. 6. When the subject T is moving in the horizontal direction, therange of the peak position is determined by the number of pixelsarranged along each horizontal line in each window W1-W9. X1 in FIG. 6represents the peak position when the peak position reference point inthe window W4 in FIG. 5(a) is denoted by A, and X2 represents the peakposition when the peak position reference point in the window W4 in FIG.5(a) is denoted by B. When the focal length, i.e. the lens position, ofthe optical system 11 is denoted by N, a range closer than N (towardsNEAR) is denoted as N−1 and a range farther than N (towards FAR) isdenoted as N+1. The point when the lens position of the optical system11 moving towards FAR from N−1 reaches N+1 is when the peak position hasmoved from the window W4 into the window W5. In this state, blur of thesubject can be easily detected even during automatic focusing, becausethe change in the peak position is obvious. Unless the portion with thehigh contrast moves across a plurality of windows, there are windows,e.g. the window W9, that have correct evaluated values even duringoccurrence of blur of the subject. Therefore, the correct peak positionof the evaluated values can be calculated by detecting a portion wherethe peak position changes across a plurality of windows and reducing theweights on the evaluated values for the windows in which such a changehas occurred.

The present embodiment is based on the method of controlling automaticfocusing that calls for weighting as described above. Therefore, inorder to facilitate the explanation, said control method is explainedhereunder, referring to flow charts shown in FIGS. 7 through 10. FIG. 7shows the overall process of focusing, and each one of FIGS. 8 through10 shows in detail a part of the focusing process shown in FIG. 7.

As shown in FIG. 7, multiple image data is used to perform focusing.First, in order to obtain image data of an image focusing area W, oneframe of a picture is taken for automatic focusing processing at theinitial position or the current position of the lens (Step 101). Usingthe data of the photographed image, a contrast evaluated value for eachwindow W1-W9 of the image focusing area W is calculated (Step 102). Whencalculating each contrast evaluated value, peak values of all the linesin the each respective window W1-W9 are summed up. Then, the averageposition of the subject T is calculated by finding relative positions ofeach of the peak values of all the lines in each window W1-W9 from areference position in the each respective window W1-W9 and summing upthese relative positions (Step 103). The number N of frames to bephotographed is calculated (Step 104), and until N times ofphotographing actions are completed (Step 105), photographing actionsare repeated while moving the lens of the optical system 11 (Step 105).In other words, lens moving and picture taking for focusing are repeatedN times (Steps 101-106) to obtain evaluated values of continuous imagedata.

In cases where the position of the lens driven in Step 106 is relativelyclose to the distance to the subject T, the average position calculatedin Step 103 based on the image data captured for focusing in Step 101sufficiently reflects the characteristics of the main contrast of thesubject T. Therefore, especially in cases where camera shake or otherincident causes movement of the subject in a window in which the cameraposition is close to the distance to the subject T, a change in theaverage of the peak positions is inevitable.

An explanation is now given of the process of calculating the number Nof frames to be photographed for focusing (Step 104), referring to theflow chart shown in FIG. 8.

The purpose of setting the number N of frames to be photographed is toobtain sufficient essential image data by changing the number N offrames to be photographed based on the lens magnification of the opticalsystem 11, the data of the distance to the subject T to be photographed,various photographing conditions set by the photographer, etc.

First, the evaluated value FV for each window W1-W9 calculated in Step102 in FIG. 7 is compared with a given reference value FVTHn (Step 201).When the evaluated value FV is greater than the reference value FVTHn,N0 is input as N (Step 202). Step 201 may be omitted. N0 may be input asa variable based on the focus magnification for N. When the evaluatedvalue FV is not greater than the reference value FVTHn (Step 201) in asituation where close-up photography is or has been chosen (Step 203) bythe photographer who is operating the image capturing apparatus 10, orwhere the focus magnification is relatively large (for example 2× ormore) (Step 204), N2 is input as N (Step 205). Under conditions otherthan those described above, in other words when the evaluated value FVis not greater than the reference value FVTHn (Step 201) in a situationwhere short-range photography is not chosen (Step 203) and where thefocus magnification is relatively small (for example less than 2×) (Step204), N1 is input as N (Step 206). The values N0,N1,N2 are smaller inthe indicated order (N0<N1<N2). To perform short-range photography orwhen the focus magnification is large, meticulous evaluation is enabledby setting a large number N of images to be captured to provide minutesetting for driving the lens of the optical system 11. On the otherhand, when the subject T is located close to the optical system 11 (forexample, when the calculated evaluated value FV is greater than a givenreference value FVTHn), duration of focusing can be reduced by setting asmall number N of images to be captured. In short, by providing a meansto selectively set the lens driving range based on an evaluated value,the duration of focusing can be reduced without impairing precision offocusing.

As shown in FIG. 7, judgment is made as to whether there is camera shakeor like affecting an average position of the peak positions obtainedthrough the N times of photographing actions, and the amount of theweight, which represents the reliability, to be placed on each windowW1-W9 is calculated (Step 111). Next, how the determining circuitcalculates the amounts of the weights is explained in detail, referringto the flow chart shown in FIG. 9.

First, Kp=PTH(base), which represents an initial value of the movingdistance of peak value average positions (PTH) is set beforehand (Step301). Then, each window Wh of the image focusing area W, in which anumber of scenes are captured, is examined to determine a single orplural scenes S(H)Wh that presents the highest evaluated value (Step302).

The peak value average position moving distance PTH is used as a finalcontrol value for selecting the amount of the weight on each window Wh.The peak value average position moving distance PTH is a variable thatchanges based on photographing conditions, such as the brightness, focallength, etc.

In cases where the brightness in a photographed scene is relatively high(Step 303), the moving distance in a window tends to be reduced becauseof an increased shutter speed. Therefore, in order to reduce the peakvalue average position moving distance PTH to a level lower than thepreset initial value Kp=PTH(base), the ratio K(L) by which the initialvalue PTH(base) will be multiplied is set at, for example, 80% (Step304). Should the brightness be not high, in other words, for example,should it be rather low (Step 303), the ratio K(L) is set at, forexample, 100% (Step 305). In cases where the focus magnification isrelatively high (Step 306), there is a higher possibility of camerashake than when focus magnification is low. Therefore, in order toreduce the peak value average position moving distance PTH to a levellower than the preset initial value PTH(base), the ratio K(f) by whichthe initial value PTH(base) will be multiplied is set at, for example,80% (Step 307). Should the focus magnification be not high, in otherwords, for example, should it be rather low (Step 307), the ratio K(f)is set at, for example, 100% (Step 308).

The peak value average position moving distance PTH, which serves as themost appropriate control value for the photographed scene, is calculatedby multiplying the preset initial value Kp=PTH(base) by ratiosK(L),K(f), which have respectively been calculated as above based on thebrightness and focus magnification (Step 309). In other words,calculation of the equation PTH=Kp×K(L)×K(f) is done. According to thepresent embodiment, the peak value average position moving distance PTHis calculated based on the brightness and focus magnification. However,incases where it is possible to find the most appropriate control valuebeforehand, the initial value PTH(base) of the peak value averageposition moving distance PTH may be directly used as the peak valueaverage position moving distance PTH.

Next, the reliability of each window Wh is calculated, which begins withinitialization of an amount of weight, i.e. a weighting factor (Step310). The weighting factor is represented in terms of proportion to100%. For example, the weighting factor may be initialized at 100%. Atthe same time, a variable m is provided with respect to the calculatedpeak value average position moving distance PTH so that the weightingfactor can be set as a variable. For example, in cases where theweighting factor can be set at four levels, m may be 4, 3, 2, or 1, with4 being the initial value.

When determining the amount of the weight, the ratio to the calculatedpeak value average position moving distance PTH is set as a changeablevalue, i.e. a peak value average position moving distance PTH(m), byusing the variable m (Step 311). To be more specific, the peak valueaverage position moving distance PTH(m) is found by dividing the peakvalue average position moving distance PTH calculated in the previousstep by the variable m.

When the difference in the absolute value between the peak value averageposition ΔPS(H)Wh in the scene S(H)Wh and the peak value averageposition ΔPS(H−1)Wh in the previous scene S(H−1)Wh is greater than thepeak value average position moving distance PTH(m), the CPU 17 servingas the determining means judges that camera shake or other similarincident has caused the subject T to move across windows W1-W9 oraffected the calculation of the evaluated value (Step 312). When thedifference in the absolute value between the peak value average positionΔPS(H)Wh in the scene S(H)Wh and the peak value average positionΔPS(H+1)Wh in the subsequent scene S(H+1)Wh is greater than the peakvalue average position moving distance PTH(m), the determining meansalso judges that camera shake or other similar effect has caused thesubject T to move across windows W1-W9 or exerted an influence on thecalculation of the evaluated value (Step 313). In cases where neitherdifference in the absolute value exceeds the peak value average positionmoving distance PTH(m), the determining means judges that there isneither camera shake nor an unfavorable influence on calculation of theevaluated value and, therefore, does not reduce the weighting factor forthe pertinent window Wh. The greater the variable m, the smaller thepeak value average position moving distance PTH(m) used in comparison,making it more difficult to determine the peak value average positionmoving distance. The weighting factors to be used are set based on thecorresponding peak value average position moving distance PTH(m) (step315). Should the difference in the absolute value be found to be greaterthan the set peak value average position moving distance PTH(m) in Step312 or Step 313, the weighting for the corresponding window Wh isreduced by reducing the weight factor, which is based on the assumptionthat camera shake is present (Step 315). At that time, the weight factormay be reduced to, for example, as low as 25%. Comparison describedabove is repeated with the value of the variable m being reduced one ata time from the initial value, e.g. 4 (Step 316), until the variable mbecomes 0 (Steps 311-317), while determining the amount of the weightbased on each variable (314,315). Although the minimum weighting factoris set at 25% according to the present embodiment, the weighting factoris not limited to this particular value; for example, the minimumweighting factor may be set at 0%. Furthermore, according to the presentembodiment described above, the peak value average position movingdistance PTH(m) is a proportion to the peak value average positionmoving distance PTH calculated in the previous step. However, aplurality of optimum control values set beforehand may be used if it ispossible.

By thus determining whether there has been camera shake by a pluralityof criteria, the reliability can be exact and multiple levels.

The operation described above is repeated until calculation for everywindow W1-W9 is completed (Steps 301-318) By means of weightingdescribed above, the reliability of each window W1-W9 is put intonumerical form as a weighting factor.

By applying the process described above to the windows adjacent to therelevant window S(H)Wh, it can be ascertained whether there has been anyinfluence of camera shake or other movement of the target that forms apeak. To be more specific, after the weighting factor, i.e. reliability,of each window Wh is calculated as shown in FIG. 7, Eval FLG is set at 0(Step 112). Thereafter, in cases where the number of windows Wh with aweighting factor or reliability of at least 100% is, not less than agiven level, e.g. 50% of all the windows (Step 113), or in cases wherethere are adjacent windows Wh, each of which has a reliability of notless than a given level, e.g. 100% (Step 114), the determining meansjudges that there is no movement of the subject T in the pertinentscene. Therefore, without performing weighting of evaluation which willbe described later, the determining means performs validitydetermination by comparing the evaluated value with a preset controlvalue (Step 117).

Should neither condition stipulated in Step 113 or 114 be fulfilled,calculation using weighting factors is performed as described hereunder.After the weighting factors for the windows W1-W9 are calculated, theentire evaluated values of each window W1-W9 are multiplied by theweighting factor calculated for the corresponding window so that weighton each evaluated value reflects on the evaluated value itself (Step115). At that time, in order to show that calculation using a weightingfactor has been performed, Eval FLG is set at 1 (Step 116).

Then, each weighted evaluated value is compared with a preset controlvalue VTH to determine whether it is greater than the control value(Step 117). Thus, a process to determine whether it is valid as anevaluation target (Step 118) or invalid (Step 119) is conducted forevery window W1-W9 (Steps 117-120).

Should a plurality of windows found to be valid, the CPU 17 finds afocusing distance by performing focusing distance calculation based onfocusing positions, i.e. partial focusing distances, of the validwindows (Step 121).

The focusing distance calculation is shown in detail in FIG. 10. First,whether calculation using a weighting factor has been performed isdetermined from the state of Eval FLG (Step 401). In cases whereweighting has been performed, the weighted evaluated values are summedup at each distance (Step 402). In cases the evaluated values have notbeen weighted, summation is not performed. Peak focusing positions, i.e.peak positions, are calculated from the evaluated values (Step 403). Incases where all the peak focusing positions are outside a givenphotographing range, i.e. a linking range (Step 404), or every peakfocusing position has a reliability not higher than a given level, e.g.25% (Step 405), it is judged that calculation of the subject distance isimpossible. In this case, the focusing position, i.e. the focal point atwhich the lens will be focused, is compelled to be set at a given value,which has been set beforehand (Step 406). At that time, focusingdistance determination is judged to be NG (Step 407).

In a situation other than the above, in other words, in cases where oneor more peak focusing positions (peak positions) are in the givenphotographing range (Step 404) and such peak focusing position(s) have areliability greater than a given level, e.g. 25% (Step 405), it isjudged that calculation of the subject distance is possible and, fromamong the valid windows W1-W9, the partial focusing position having thepeak position at the closest focusing distance is chosen as the focusingposition (Step 408). At that time, focusing distance determination isjudged to be OK (Step 409).

When the focusing distance calculation described above includesweighting, the evaluated values are summed up in Step 402 to produce asingle evaluated value so that the resulting peak position representsthe position of the center of gravity of plural evaluated values.However, the invention is not limited to such a configuration; it isalso possible to choose only the windows whose peak positions are at aclose distance, perform summation for each window, then calculate thepartial focal point position, and set it as the focusing position. Incases where weighting has not been performed, it is also possible tochoose the partial in-focus position at the closest distance from thewindows W1-W9 that hold valid evaluated values, and set the partialfocal point position as the focusing position.

Based on the result of determination of focusing distance, (Step 407 or409) which has been obtained by the focusing distance calculationdescribed above (Step 121), judgment is made as to whether the result offocusing distance determination is OK or NG as shown in FIG. 7 (Step122). If the result is OK, the lens of the optical system 11 is moved tothe set focusing position (Step 123). In case of NG, the lens of theoptical system 11 is moved to the aforementioned preset focusingposition (Step 124). Thus, the lens can be positioned at the finalfocusing position.

The device described above is an automatic focusing device used in animage capturing apparatus, such as a digital camera or a video cameraand uses image data to perform automatic focusing by a method whichcalls for dividing a frame into a plurality of areas and determining afocusing position in each area. Even for a scene containing anobstruction to range finding, such as movement of the subject or camerashake, the device according to the embodiment is capable of appropriaterange finding and focusing the optical system 11 by detecting blur andusing only the optimal data.

To be more specific, when peaks of evaluated values for respectiveplural areas have been calculated, a conventional device may simply useas the focusing position the partial focal length that is the focusingposition at which the highest evaluated value has been recorded.However, by means of evaluated value weighting that takes into accountthe reliability of the evaluated values, the device according to theinvention eliminates partial focal lengths obtained from windows havinglow reliability due to camera shake or other causes, uses only reliableevaluated values, even if they are not the highest values, to make ajudgment and selects the partial focal length at the closest distancefrom among the evaluated values that have been ascertained to be valid.By using this method, which increases the probability of accuratefocusing, the device is capable of making accurate judgment of thefocusing position and thereby enables in-focus photography. The deviceaccording to the embodiment is particularly valid when used in anoptical system 11 of a so-called high-magnification type having a highzooming ratio.

Should the evaluated values themselves prior to weighting be low (e.g.evaluated values affected by noises or other factors or evaluated valuesin windows in which there is no valid subject), the embodiment iscapable of accurate detection of the focal length by treating suchwindows to be invalid.

To be more specific, giving priority to the short range when calculatinga plurality of focal lengths in a plurality of areas is a methodgenerally deemed effective. However, should there be an erroneous peakat a distance shorter than the subject distance due to movement of thesubject or camera shake, giving priority to the short range through aconventional process may prevent the location of the subject from beingrecognized as the focusing position and, instead, cause the erroneouspeak to be determined as the focusing position, resulting in failure insetting the correct focusing position. Even if there is an erroneouspeak at a distance shorter than the subject distance due to movement ofthe subject or camera shake, the device according to the embodiment iscapable of detecting the movement of the subject or camera shake andusing only the optimal data and thereby reliably setting an appropriatefocusing position while giving priority to the short range.

There is a conventional method that calls for correcting blur of animage of the subject or camera shake by changing the image detectingarea and performing evaluation of the focal point again after the changeof the image detecting area. Such a method presents a problem in that ittakes a long time to complete calculation of the focusing position,resulting in a missed picture-taking opportunity. The constitutiondescribed above, however, enables rapid processing and capture of theshutter release moment, because the focusing position is calculatedsolely from the information obtained from preset image detecting areas.

By eliminating the need of an acceleration sensor or any other specialdevice or equipment for detecting blur of an image of the subject orcamera shake, the embodiment simplifies the structure of the automaticfocusing device and thereby reduces its production costs.

By increasing the reliability of the calculated plural subjectdistances, the embodiment makes it possible to devise other algorithms.

As a focal point position is calculated based on evaluated valuesobtained from preset image detecting areas, the user can avoid anydiscomfort that would otherwise be felt from the lens focusing on anuntargeted subject.

As the device is not affected by change in the brightness of imageshaving flicker from such sources as a fluorescent lamp or the like andis therefore free from the problem of fluctuation in peak positions ofevaluated values of the image, the device according to the embodiment iscapable of evaluating the reliability of each one of the plural areasregardless of each evaluated value.

The embodiment described above employs a so-called hill-climbing searchrange finding method, which calls for obtaining evaluated values at aplurality of positions while operating the optical system 11, andrecognizing a peak at the point when the curve of evaluated valueschanges from upward to downward. Should blur of a subject image occur,the peak position of each window moves inside the window and then intoan adjacent window W1-W9. When the peak position of the contrast of thesubject T moves from one window to another, the peak value of theevaluated values for the first-mentioned window decreases sharply. Byreducing the weight on any window of which there has been a suddenchange in the evaluated values with respect to a scene capturedpreviously or immediately afterwards, the embodiment ensures eliminationof data containing influence of camera shake and enables the accuraterange finding and focusing, using only the most appropriate data.

The method described above calls for summation of the peak positions ofthe evaluated values. There is a variable in the peak positions of arelatively unfocused image. Therefore, according to the above method,the weight can be reduced when given to a window having a wide variablein the peak positions or having low peak values from the beginning.

As described above, at each change of the lens position of the opticalsystem 11, the focusing device using the above method measures eitherthe difference between peak values of evaluated values in the samewindow or the difference in the moving distance between the averageposition of the peak positions in one window and the average position ofthe peak positions in an adjacent window, or measures both kinds ofdifferences. By performing this measurement, the device determines thereliability of the evaluated values of the pertinent window, therebyincreasing the reliability of the window. Therefore, in cases where theshort range is selected from among focal point positions in a pluralityof areas at the time of deciding a final focusing position, rangefinding is performed with an increased reliability even if camera shakeor movement of the subject should occur.

With the features as above, even if there is blur of the subject, thereliability of focusing can be increased.

Although the invention is explained referring to the constitution thatcopes with horizontal movement of a subject T, the invention is alsoapplicable to devices that cope with vertical or diagonal movement of asubject or any combination of these movements.

The image processing circuit 15 shown in FIGS. 1 and 2 may be formed ofthe same chip as that of another circuit, e.g. the CPU 17, or executedby the software of the CPU 17. By thus simplifying the circuits, theirproduction costs can be reduced. The filter circuits 32 of the imageprocessing circuit 15 may be in any form, provided that they are capableof detecting contrast.

The range finding is not limited to the aforementioned hill-climbingsearch method and may be executed by scanning the entire range in whichthe automatic focusing device can operate.

Other than the procedure described above, it is also possible to sum upthe evaluated values of a plurality of adjacent windows, after theweighting process shown in FIG. 9. Weighting may also be performed aftersummation of the evaluated values for a plurality of selected windows.

According to the method described above, one each value is set as thepeak value average position moving distance PTH and the control valueVTH for the process shown in FIGS. 7 and 9. However, it is also possibleto determine these values by selecting from among a plurality of presetvalues. Furthermore, these values may vary depending on the largeness ofthe evaluated values or various photographing conditions including thebrightness and data of the optical system 11, such as the shutter speed,focus magnification, etc. If such is the case, the optimal values may beselected based on these conditions or found by calculation using theseconditions and data as variables in order to perform evaluation suitablefor each scene.

When taking a picture using an electronic flash, by obtaining image dataof respective scenes with the electronic flash emitting light in syncwith each picture taking for focusing, a focusing distance can bedetected by the focal length detecting method described above. When anelectronic flash is used together with a device according to theinvention, photographing is performed under control of light emissionfrom the electronic flash based on the focusing distance and control ofquantity of light, i.e. control of the aperture of the camera, shutterspeed, etc.

The method described above chooses the partial focal length at theclosest distance, i.e. the partial focusing position having the peakposition at the closest distance, from among the valid evaluated values,and sets such a partial focusing position as the focusing position (Step408). However, the invention is not limited to such a process; inaccordance with the intention of the user (to be more specific, inresponse to operation by the user, i.e. the photographer, to select thephotographing mode), a partial focusing position other than the closestpartial focusing position may be selected as the focusing positiondirectly by the photographer or automatically as a result of selectingfunction of the control means in response to operation by thephotographer. Furthermore, according to the method, when the result offocusing distance determination is NG (Step 122), the lens of theoptical system 11 is moved to a preset focusing position (Step 124).However, it is also possible to set a plurality of focusing positionsbeforehand and move the lens of the optical system 11 to one of thepresent focusing positions in accordance with the intention of thephotographer, i.e. operation by the photographer to select thephotographing mode.

The focal length detecting method described above calls for setting aplurality of image detecting areas adjacent to one another, obtainingmultiple image data while changing the focal length of an opticalsystem, calculating from said multiple image data a partial focal lengthfor each image detecting area based on which image data the peak valueof contrast evaluated values has been recorded in, calculating thereliability of each image detecting area based on the position at whichsaid peak value has been recorded moving across the multiple image data,and selecting a focal length from a group consisting of said partialfocal lengths and at least one given focal length, said focal lengthselected based on the reliability and the evaluated values of eachrespective image detecting area. As each reliability is calculated basedon the position at which the peak value of the contrast evaluated valueshas been recorded moving across the multiple image data so that thepartial focal length of an image detecting area that has a lowreliability due to relative movement of the subject is excluded fromselection, the method described above enables the accurate detection ofthe focal length.

According to the focal length detecting method, weighting of evaluatedvalues is performed based on the calculated reliability, and a focallength is selected from among the partial focal lengths of the imagedetecting areas based on the evaluated values thereof to which weightinghas been applied. By using evaluated values to which weighting has beenapplied based on a calculated reliability so that the partial focallength of an image detecting area having a low reliability is excludedfrom selection, the method described above enables the accuratedetection of the focal length.

According to the focal length detecting method, should a position atwhich a peak value has been recorded move from at least one imagedetecting area that contains said position into at least one other imagedetecting area, the reliability of the first-mentioned image detectingarea is reduced. With the feature described above, the aforementionedmethod enables the accurate detection of the focal length by excludingthe partial focal length of an image detecting area having a lowreliability due to relative movement of the subject from selection.

According to the focal length detecting method, should a position atwhich a peak value has been recorded move more than a given distanceacross plural image detecting areas that contain said positions at whichpeak values have been recorded, the reliability is reduced. With thefeature described above, the aforementioned method enables the accuratedetection of the focal length by excluding the partial focal length ofan image detecting area having a low reliability due to relativemovement of the subject from selection.

According to the focal length detecting method, in cases where imagedata containing a great peak value has been obtained, the number ofimages to be subsequently obtained as data is reduced. With the featuredescribed above, the method enables the reduction of time needed forfocusing by obtaining only sufficient essential image data.

According to the focal length detecting method, a peak position movementdetermining value, which is used at the time of calculation of areliability for determining whether a position at which a peak value hasbeen recorded has moved is a variable calculated based on photographingconditions. With the feature described above, the method enables thedetection of an appropriate focal length by setting a peak positionmovement determining value based on photographing conditions, therebyenabling calculation of a reliability factor more appropriate for thephotographing conditions.

According to the focal length detecting method, a plurality of peakposition movement determining values are set for determining at the timeof calculation of a reliability whether a position at which a peak valuehas been recorded has moved, and the peak position movement determiningvalues are sequentially compared with the multiple image data. Bysetting a plurality of peak position movement determining values andsequentially comparing these values with the image data, the methodhaving this feature enables the setting of reliability in a plurality oflevels and thereby ensures detection of an appropriate focal length.

The focusing device described above comprises an image pickup device, anoptical system for forming an image on the image pickup device, anoptical system driving means for changing the focal length of theoptical system, and an image processing means for processing image dataoutput from the image pickup device and controlling the optical systemdriving means, wherein the image processing means is adapted to obtainmultiple image data while changing the focal length of the opticalsystem by controlling the optical system driving means, define aplurality of image detecting areas adjacent to one another in each oneof the multiple image data obtained as above, calculate a partial focallength for each image detecting area based on which image data the peakvalue of contrast evaluated values has been recorded in and alsocalculate the reliability of each image detecting area based on theposition at which said peak value has been recorded moving across themultiple image data, and select a focal length from a group consistingof said partial focal lengths and at least one given focal length, basedon the reliability and the evaluated values of each respective imagedetecting area. As each reliability is calculated based on the positionat which the peak value of the contrast evaluated values has beenrecorded moving across the multiple image data so that the partial focallength of an image detecting area having a low reliability due torelative movement of the subject is excluded from selection, the devicedescribed above is capable of selecting an accurate focal length andappropriate focusing.

Next, a focal length detecting method and a focusing device according tothe present embodiment of the invention are explained, referring toFIGS. 11 through 16.

This embodiment is based on the method described above and shown inFIGS. 7 through 10. According to this embodiment, the photographer isallowed to select image data to be used for establishing the lensposition, in other words final determination of the focal length. Thephotographer is enabled to make this selection automatically or manuallyfrom among RGB image data consisting of Red signals (R), green signals(G) and blue signals (B), in addition to brightness data, i.e. imagedata representing normal YCC brightness data. Furthermore, in additionto the short-range priority mode (the normal mode), which is a normalphotographing mode, the photographer may also select the long-rangepriority mode; the photographer may even designate a desired range ofphotographing distance, i.e. a linking range, by means of a mode thatcan be called a far distance mode or an infinity mode. In thedescription hereunder, the explanation of the same elements orcomponents as those of the constitution shown in FIGS. 1 though 10 isomitted.

The device according to the present embodiment includes an operatingmeans for determining whether selection of image data (brightness dataor color data) to be used for determining the focal length is madeautomatically or manually by the photographer, an operating means forsetting, in cases where manual operation has been selected, which colorwill be used for determining the focal length, and an operating meanswhich is a photographing mode selecting means to permit the photographerto choose the long-range priority mode or the far distance mode. Itsfunction is similar to the function of focusing shown in the flow chartof FIG. 7 except that, as shown in FIG. 11, setting of a desiredphotographing mode (Step 11) and image signal determining processing(Step 12) are performed prior to taking a picture for automatic focusingprocessing (Step 101) and that the details for calculation of thereliability of each window (Step 111) and focusing distance calculation(Step 121) are different. Said calculation of the reliability of eachwindow is performed in order to determine the amount of the weight to beplaced on each evaluated value used for calculation of the focal lengthfor the image data selected by the image signal determining processing.

First, an explanation is given of the process of setting the desiredphotographing mode. When focusing process involves designation of arange of photographing distance, it is necessary to know, as criteriafor focusing, the range of photographing distance through the lensdriving range based on the photographing modes of the image capturingapparatus 10. Should the photographing modes of the image capturingapparatus 10 include a normal mode which covers, for example, 50 cm tothe infinity, the lens driving range is set for this mode. If the imagecapturing apparatus 10 has other modes than the normal mode, such as afar distance mode. (an infinity mode), a macro mode, etc., an operatingmeans to enable the photographer to select any of these modes, in otherwords an operating means that enables the photographer to set the rangeof photographing distance, i.e. the lens driving range, is provided.

In the process of focusing, whether determination of the final focallength gives priority to the short range or the long range has to bedecided as criteria for focusing. This is determined by the photographerselecting a photographing mode by operating the operating means of theimage capturing apparatus 10. Should the photographing mode of the imagecapturing apparatus 10 be set at the long-range priority mode, settingis made to employ a longest-distance selecting mode for driving the lensso that the focusing distance corresponds to the longest distance in acaptured image. In cases where the short-range priority mode has beenselected, the focusing device is set at the shortest-distance selectingmode so that the focusing distance corresponds to the shortest distancein a captured image, thereby enabling photography with priority given tothe short range, which is the mode generally employed.

The process of setting the desired photographing mode shown in FIG. 11(Step 11) begins with ascertaining whether the photographer hasdesignated the range of photographing distance as shown in FIG. 12 (Step1201). In cases where the mode for selecting the range of photographingdistance has been selected, judgment is made as to whether the fardistance photographing mode has been selected (Step 1202). In caseswhere the far distance mode has been selected, the longest-distanceselecting mode is selected (Step 1203). In cases where the far distancemode has not been selected (in other words when either the macro mode orthe normal mode has been selected), the shortest-distance selecting modeis selected (Step 1204). In short, the photographing mode, i.e. whetherpriority is given to the short range or the long range, is automaticallydecided in these steps based on the range of photographing distance.

In cases where the mode for selecting the range of photographingdistance has not been selected in Step 1201, judgment is made as towhether long-range priority mode has been selected (Step 1205). If thephotographer has selected the long-range priority mode, thelongest-distance selecting mode is selected (Step 1203). In cases wherethe long-range priority mode has not been selected, theshortest-distance selecting mode is selected (Step 1204). In otherwords, the photographing mode that will determine the final focusingdistance with priority on the intention of the photographer is selectedin these steps.

The image signal determining processing (Step 12) shown in FIG. 11 isfor making selection between a manual mode and an automatic mode to beused in the focusing process from Step 11 to Step 106 in FIG. 11. Theaforementioned manual mode is for the photographer to manually selectbrightness data or color data based on the subject or other conditions,whereas the automatic mode calls for the image capturing apparatus 10 toperform the selection automatically. The image signal determiningprocessing, which is shown in FIG. 13 in detail, begins withascertaining whether the photographer has chosen the manual mode forusing either the brightness data or the color data from the image datainformation (Step 1301). In cases where the manual mode has beenselected, judgment is made as to whether the photographer has chosen themode for using the color data (Step 1302). In cases where the color datais not going to be used, the device is automatically switched to themode for using only the brightness data (Step 1303). As the RGB colordata is not going to be used, the variable CN is stored as 1 (CN=1)(Step 1304). In cases where the mode for using the color data ratherthan the brightness data for focusing has been selected in Step 1302,the device is enabled to put into numerical form a desired amount ofweight to be placed on the color data of each RGB color. The numericalvalues will be used as set values in calculation of a focal length (Step1305). For example, in cases where selection has been made so as to usethe color data of the three RGB colors, the variable CN, whichrepresents the number of color data items, is stored as 3 (CN=3) (Step1306). Settings of the matrix complementary circuit 27 and the switch 28shown in FIG. 2 are made based on setting of the color data or thebrightness data, such as the variable CN described above.

In cases where the manual mode has not been selected in Step 1301, thedevice functions in the automatic mode for automatically selecting colordata or brightness data. In the automatic mode, the first procedure isto examine the value of brightness in the photographing environment(Step 1307). Should the current brightness value LV be lower than apreset brightness value LVTH, it is decided that the brightness dataalone should be used as the image data for focusing due to the lack ofcolor data, resulting in the subsequent progression to Step 1303. Incases where availability of the color data has been ascertained in Step1307, weighting factors for the respective RGB colors are automaticallyset based on various settings, such as the photographing mode set inStep 11.

In cases where a white balance follow-up mode has been chosen (Step1308), the weights on the information of each RGB color is automaticallyset based on the current information regarding the subject, such as thecolor data and the white balance WB (Step 1309). For example, in caseswhere it has been judged that the subject contains a relatively largeamount of red (R), the weights to be placed on evaluated values arecalculated so that a greater value is set as a weight on R whilerelatively small values are set as the weighting factors for green (G)and blue (B).

Although it is not shown in the drawings, in cases where setting of aplurality of image areas is permitted, it is also possible to detectcolor data in each one of the image areas and set a great weight on thecolor with the greatest value.

Furthermore, weights on evaluated values may be set so as to deal withany one of a plurality of photographing modes other than those set inStep 11 (Step 1310).

For example, in the case of the present embodiment, which is providedwith an auxiliary light device 23, based on the settings for control oflight emission from the auxiliary light sources L1,L2 by the auxiliarylight device 23 (Step 1311), the prescribed weight for each respectiveRGB color data is set either automatically or manually (Step 1312,1305).An auxiliary light determining processing, which controls the auxiliarylight sources L1,L2, is explained in detail, referring to FIG. 14. Whenselecting the photographing mode, the photographer can choose whether tocause the auxiliary light sources L1,L2 to emit light manually orautomatically (Step 1401). In cases where the manual mode has beenselected in Step 1401, a single light source or a combination of lightsources L1,L2 are selected from among the plurality of auxiliary lightsources L1,L2 of auxiliary light device 23 of the image capturingapparatus 10 so that the selected light source(s) L1,L2 will emit lightin accordance with the selection of the photographer (Step 1402). Incases where the manual mode has not been selected in Step 1401, thedevice functions in the automatic mode to automatically cause theauxiliary light source(s) L1,L2 to emit light when it is necessary(Step1403). Whether or not light emission from the auxiliary light source(s)L1,L2 is necessary is judged by the CPU 17 based on the brightness dataor other relevant information. When automatically causing the auxiliarylight source(s) L1,L2 to emit light, the CPU 17 performs calculationbased on information of the subject, such as brightness data or colordata (Step 1404), to make judgment as to what color of auxiliary lightL1,L2 is appropriate. As a result of the automatic calculation or themanual setting, judgment is made as to whether light emission from aplurality of auxiliary light sources L1,L2 is necessary. In cases wherelight emitted from a single auxiliary light source L1,L2 is sufficient,the optimal amount of weight to be placed on the evaluated value of eachRGB color data is selected to obtain the maximum evaluated value (Step1408 or 1409) based on the color data of the light from the selectedauxiliary light source L1,L2, i.e. either the first auxiliary lightsource L1 (Step 1406) or the second auxiliary light source L2 (Step1407).

It is also possible to use three or more auxiliary light sources L1, L2. . . LN and set an appropriate weight for each respective auxiliarylight source L1, L2 . . . LN (Steps 1410,1411). Should the color data ofeach auxiliary light source L1, L2 . . . LN remain undetermined, it mustbe processed as an error. If such is the case, the amount of the weightis set as if it were set for the first auxiliary light source L1, whichis the normal auxiliary light source (Step 1408). The process when aplurality of auxiliary light sources L1,L2 are caused to emit lighteither manually or automatically (Step 1405) is now explained. Forexample, when causing the first auxiliary light source L1 and the secondauxiliary light source L2 to emit light simultaneously (Step 1412), theoptimal amount of weight to be placed on the evaluated value of each RGBcolor data is selected to obtain the maximum evaluated value (Step 1413)based on the color data of the light resulting from simultaneous lightomission from the auxiliary light sources L1,L2. When causing an Nnumber of auxiliary light sources L1, L2 . . . LN in combination to emitlight (Step 1414), the amount of the weight for each respectiveauxiliary light source L1, L2 . . . LN to obtain the optimal result ofthe combination of these auxiliary light sources is selected (Step 1415)in the same manner as in the case of causing a combination of twoauxiliary light sources L1,L2 to emit light. Should the color data ofthe combination of auxiliary light sources L1, L2 . . . LN remainundetermined, it must be processed as an error as is the case of asingle auxiliary light source L1, L2 . . . LN emitting light. If such isthe case, the amounts of the weights are set as if the combination ofthe lights sources consisted of the first and second auxiliary lightsources L1,L2, which is the normal combination of auxiliary lightsources (Step 1413). When at least one of the auxiliary light sourcesL1, L2 . . . LN is going to be caused to ultimately emit light, thevariable LweightFlg is stored as 1 (Step 1416). When none of theauxiliary light sources L1, L2 . . . LN is going to emit light, thevariable LweightFlg is stored as 0 (Step 1417). Then, the auxiliarylight determining processing returns to the flow chart shown in FIG. 13.In cases where light is emitted from at least one of the auxiliary lightsources L1, L2 . . . LN in the photographing mode (Step 1304) in theflow chart shown in FIG. 13, the variable LweightFlg is used fordetermining whether the setting of the amount(s) of the weight(s)described above has been completed.

In cases where light emission from the auxiliary light sources L1, L2 .. . LN is not selected (Step 1311), and the photographing range isshort, in other words when performing macro photography (Step 1313), itcan be assumed that the color data of the subject contains relativelyvivid colors. Therefore, the amount of the weight for every RGB colordata is set so that each RGB color is given a great weight (Step 1314).

Should the target of the photograph be limited to a specific subject,the amounts of the weights are set so as to facilitate focusing on thesubject and also substantially reduce the possibility of focusing on thecolors of any other objects that are expected to be near the subject.For example, should a mode for specifying flowers as the subject havebeen chosen (Step 1315), the weight on green (G) is reduced (Step 1316)in order to prevent erroneous focusing on green leaves rather than th4eflower that is the targeted subject.

In cases other than any of the ones previously discussed, to be morespecific, in cases where none of the modes for tracking colortemperature or white balance has been selected (Step 1308), and nospecific photographing mode is set, in other words, in the case of whatis referred to as a no-setting mode (Step 1310), a preset weight is set(Step 1317), and the variable CN, which represents the number of colordata items, is stored as 3 (CN=3) (Step 1306). With the non-specificmode, a weight may be set so as to facilitate focusing on, for example,human skin color.

As described above, preset amounts of weights are sets in Steps 1309,1312, 1314, 1316, 1317, 1408, 1409, 1411, 1413 and 1415 in the imagesignal determination processing and the auxiliary light determiningprocessing shown in FIGS. 13 and 14. Based on the color data or thebrightness data set in the manner described above, color data orbrightness data is set in the matrix complementary circuit 27 and theswitch 28 shown in FIG. 2.

After the process from Step 101 to Step 120 shown in FIG. 11 iscompleted, the final focusing calculation in the focusing process isdetermined based on the selected photographing mode.

The process from Step 11 to Step 106 is repeated to obtain evaluatedvalues of one set of continuous image data. In cases such as when thereare a plurality of color data items, a plurality of sets of evaluatedvalues are obtained. If such is the case, in order to process theplurality of sets of evaluated values, the process of calculation of thereliability of each window in Step 111 and the process of multiplicationof the weight on each evaluated value in Step 115 are different fromthose of the constitution shown in FIG. 7.

To be more specific, the weight on each evaluated value obtained fromimage data containing brightness data or color data selected as abovecan be set in step 111 shown in FIG. 11, i.e. the process shown in FIG.15. However, should there be a plurality of color data items of theimage data, the evaluated value for each window Window(Wh) is calculatedby using the color data CN, which has been stored beforehand. First, inthe same manner as the process shown in FIG. 9, a series of processesfrom Step 301 to Step 318 shown in FIG. 15 are conducted in the samemanner as the processes shown in FIG. 9. The value CNB is thencalculated from the equation CNB=CN−1 (Step 319). Thereafter, theevaluated value Window(Wh) that has been calculated as above is replacedwith the amount of the weight Window (Wh) (CNB) (Step 320). Should thecalculated result of the value CNB be 0 (Step 321), it is obvious thateither brightness data alone or color data of a single color issufficient. Therefore, the value of the amount of the weight Window(Wh)(CNB), which has replaced the evaluated value Window(Wh) in Step 320, isstored as a calculated result of reliability (Step 322). In the case ofCN=3, calculation of an amount of weight Window(Wh) (CNB) is repeateduntil processing of the color data for all three colors is completed.After calculation of all the sets of evaluation values, in other words,calculation for all the colors, is completed, the amounts of the weightsWindow(Wh) (CNB) for the color data of the evaluated values Window(Wh)for the respective windows are stored (Step 322).

After the process from Step 112 to Step 114 in the flow chart shown inFIG. 11 is completed, calculation is performed by multiplying theevaluated values by the weights by using the amounts of the weightsWindow(Wh) (CNB) for the color data of the evaluated values Window(Wh)for the respective windows (Step 115). This calculation is a process ofmultiplying each evaluated value by reliability, i.e. an amount ofweight. In the case of the present embodiment, calculation is performedfor each color data, because the color data evaluated value and itsreliability have already been obtained for each window. Therefore,weighting calculation for an evaluated value Window(Wh) of each windowis performed based on the equation:Evaluated value (Wh)=Σ{FocusValue(CNB)×Window(CNB)}/CNB

However, in the case of CN=1, the calculation is performed in the samemanner as Step 115 shown in FIG. 7.

The entire evaluated values of each window W1-W9 are multiplied by theevaluated value (Wh) that has been found as above.

After the process from Step 117 to Step 120 shown in FIG. 11 iscompleted, focusing distance calculation shown in FIG. 16 is performedin step 121, instead of the steps shown in FIG. 10.

First, in the same manner as the process shown in detail in FIG. 10,whether calculation using a weighting factor has been performed isdetermined from the state of Eval FLG (Step 1601). In cases whereweighting has been performed, the weighted evaluated values are summedup at each distance (Step 1602). In cases the evaluated values have notbeen weighted, summation is not performed. Peak focusing positions, i.e.peak positions, are calculated from the evaluated values (Step 1603). Incases where the photographing range, i.e. the linking range, has beenset based on the photographing mode selected in Step 11 shown in FIG. 11(Step 1604), should all the peak focusing positions be outside thepreset photographing range (Step 1605), or every peak focusing positionhave a reliability not higher than a given level, e.g. 25% (Step 1606),it is judged that calculation of the subject distance is impossible(Step 1607). In this case, the focusing position, i.e. the focal pointat which the lens will be focused, is compelled to be set at a givenvalue, based on the photographing mode set in Step 11. The photographingmode is either the shortest-distance selecting mode or thelongest-distance selecting mode. Therefore, in cases where calculationof the subject distance is judged to be impossible, it is determinedwhether the current mode is the longest-distance selecting mode (Step1607). When the current mode is the longest-distance selecting mode, agiven distance, i.e. Distance 1, is set (Step 1608). When the currentmode is not the longest-distance selecting mode, another given distance,i.e. Distance 2, is set (Step 1609). Distance 1 is greater than Distance2 (Distance 1>Distance 2). At that time, focusing distance determinationis judged to be NG (Step 1610).

Should every peak focusing position have a reliability not higher than agiven level, e.g. 25% (Step 1606) in the situation where the linkingrange has not been set based on the photographing mode determined inStep 11 shown in FIG. 11 (Step 1604), calculation of the subjectdistance is judged to be impossible (Step 1607), and the same procedureas above is followed (Steps 1608-1610).

In cases other than the previously discussed Steps 1604-1605, to be morespecific, in cases where the linking range has been set (Step 1604), oneor more peak focusing positions (peak positions) are in the range ofphotographing distance that corresponds to the set photographing mode(Step 1605), and such peak focusing position(s) in the photographingrange have a reliability greater than a given level, e.g. 25% (Step1606), calculation of the subject distance is judged to be possible. Inorder to decide the peak position, which photographing mode has beenselected in Step 11 is determined. Should the longest-distance selectingmode be the selected mode (Step 1611), the partial focusing positionhaving the peak position at the longest distance is selected from amongthe valid windows W1-W9 and set as the focusing position (Step 1612).Should the longest-distance selecting mode be not the selected mode(Step 1611), in other words in cases where the current mode is theshortest-distance selecting mode, the partial focusing position havingthe peak position at the shortest distance is selected from among thevalid windows W1-W9 and set as the focusing position (Step 1613). Atthat time, focusing distance determination is judged to be OK (Step1614).

Should there be at least one peak focusing position having a reliabilityhigher than a given level, e.g. 25% (Step 1606) in the situation wherethe linking range has not been set based on the photographing modedetermined in Step 11 shown in FIG. 11 (Step 1604), calculation of thesubject distance is judged to be possible, and the same procedure asabove is followed (Steps 1611-1614).

According to the result of focusing distance determination (Step 1610 or1614) which has been obtained by focusing distance calculation describedabove (Step 121), as shown in FIG. 7, judgment is made as to whether theresult of focusing distance determination is OK or NG (Step 122). If theresult is OK, the lens of the optical system 11 is moved to thecalculated focusing position (Step 123). In case of NG, the lens of theoptical system 11 is moved to the aforementioned preset focusingposition, i.e. Distance 1 or Distance 2 (Step 124). Thus, the lens canbe positioned at the final focusing position.

As is described above, according to the present embodiment, use of colordata when detecting a focal length based on image data enables thecorrect detection of the focal length for a subject containing variouscolor data in various photographing conditions. In other words, theembodiment increases the accuracy of focusing by providing a rangefinding method which calls for applying weight calculation to contrastevaluated values of the color signals of the image signals and therebyusing only the optimal data and a focusing device using such a rangefinding method. Unlike a constitution that involves focusing based onevaluated values obtained by extracting only high-frequency componentsof brightness signals obtained from image data, using information otherthan brightness data, such as color data, enables the range finding fora subject, the distance to which cannot be measured from evaluatedvalues of high-frequency components that have been extracted based onlyon difference in brightness. Therefore, the present embodiment enablesthe reduction of the types of subjects that present difficulties infocus control.

To be more specific, a focusing device according to the presentembodiment has a means to detect contrast evaluated values for aplurality of color data, in other words contrast evaluated values forrespective multiple image data obtained through at least two colorfilters of different colors, and a means (the matrix complementarycircuit 27 and the switch 28) and processes (See Step 12 in FIG. 11) tomake selection from among said multiple image data and performcalculation on the selected image data, in addition to conducting afocusing process for each one of the multiple image data. The deviceaccording to the embodiment also has a means to perform weightingcalculation for contrast evaluated values of each image data selectedand processed by said means and processes.

According to the present embodiment, the amount of the weight ofreliability of each evaluated data that has been obtained for each oneof multiple image data is calculated for each one of the plurality ofimage detecting areas defined in each image data (See Steps 319-322 inFIG. 15).

Furthermore, calculation (See Step 115 in FIG. 11) is performed to applyweighting (See Step 111 in FIG. 11) to the evaluated values obtainedbased on the photographing mode (See Steps 11-12 in FIG. 11, FIG. 12 andFIG. 13). Then, based on the evaluated values to which weighting hasbeen applied, a given focal length appropriate for the photographingmode is selected from among partial focal lengths of the image detectingareas.

Based on output color data or white balance signals, the imageprocessing circuit 15 consisting of the CPU 17 and other componentsperforms application (See Step 115 in FIG. 11) of weighting (See Step111 in FIG. 11, Step 1309 in FIG. 13 and other relevant steps) to theobtained evaluated values and, by using the evaluated values to whichweighting has been applied, selects a given focal length appropriate forthe photographing mode from among partial focal lengths of the imagedetecting areas.

A focusing device according to the present embodiment has a means toautomatically (See the procedure from NO in Step 1301 onwards in FIG.13) change over multiple image data (See the matrix complementarycircuit 27, the switch 28 and Step 12 in FIG. 11) used for calculationof the focal length.

A focusing device according to the present embodiment has a means tomanually (See the procedure from YES in Step 1301 onwards in FIG. 13)change over multiple image data (See the matrix complementary circuit27, the switch 28 and Step 12 in FIG. 11) used for calculation of thefocal length.

A focusing device according to the present embodiment has a means toautomatically change over the image data containing the color data (Seethe matrix complementary circuit 27) used for calculation of the focallength based on the brightness of the subject (See Step 1307 in FIG.13).

A focusing device according to the present embodiment has a means (SeeSteps 1301-1305 in FIG. 13) to enable the photographer to set a desiredamount of weight (See Step 12 in FIG. 11) for each contrast evaluatedvalue obtained from the image data (See the matrix complementary circuit27, the switch 28 and Step 12 in FIG. 11) used for calculation of thefocal length.

Furthermore, according to the present embodiment, evaluation isperformed based on weighting, and a given focal length appropriate forthe photographing mode is selected from among partial focal lengths ofthe image detecting areas.

As described above, because of inclusion of a means to select andprocess a single image signal or a plurality of different image signalsfrom among a plurality of different image data, a means to performfocusing by using evaluated values of a focusing device according to thepresent embodiment is able to recognize the contrast of an image in widerange of situations, in other words, recognize the contrast of a subjectimage containing various color data under various photographingconditions. Furthermore, by applying weighting to evaluated values ofeach image data of a plurality of photographed images, the deviceaccording to the embodiment is capable of focusing calculationappropriate for the features of the subject.

As weighting is applied to evaluated values of each one of multipleimage data based on color data or white balance, contrast is evaluatedin accordance with the optimum criteria for the subject.

The embodiment also includes an automatic mode for automaticallyselecting multiple image data based on a subject. Therefore, by usingthe automatic mode, the photographer can concentrate on taking pictures.

The embodiment also includes a manual mode for making selection ofmultiple image data manually. Therefore, by using the manual mode, thefocusing process can directly reflect the photographer's intentions. Asmanual setting enables not only selection of image data but also directsetting of the amounts of the weights, which are essential for weightcalculation in the focusing process, the manual setting enables focusingeven under certain photographing conditions that would make focusing bya conventional constitution difficult.

As the manual mode includes a mode for permitting the photographer toselect image data for focusing or set the amounts of the weights basedon the selected photographing mode or other selection of conditionsunder which a subject is photographed, a focusing position that meetsthe photographer's expectation can be selected.

Conventional focusing processing that calls for calculation of aplurality of focal lengths in a plurality of areas and determination ofthe final focal length is performed by using brightness data alone or asingle type of information that is similar to brightness data. However,by using evaluated values based on color data of different colors andapplying weighting to these evaluated values with the photographer'sintention reflected in the weighting by setting a photographing mode orby any other means, the present embodiment enables accurate focusing.Furthermore, in the automatic mode, the constitution according to thepresent embodiment enables easy and accurate focusing by discerningfeatures of the subject based on the color data and automaticallyweighting the evaluated values.

There may be occasions where a constitution that uses only a data ofbrightness or a single color is unable to detect contrast in an imagehaving a uniform brightness even if the contrast is recognizable to thehuman eye because of color data. However, even under poor photographingconditions, such as when movement of the subject or camera shake isoccurring in low-light condition, the use of data of a plurality oftypes selected from data of different colors and brightness enables thedetection of contrast edges and also prevents erroneous recognition of apeak of evaluated values. Therefore, accurate focusing even on such asubject as one for which focusing is difficult by a conventional methodor device is ensured.

When the photographer uses the manual mode in order to achieve focusingbased only on color data of a specific color of a subject, thephotographer can set the weights to be placed on the evaluated valuesbased on spectral color data or brightness data of image data to be usedfor focusing. This feature of the embodiment enables focus control thatmeets the photographer's expectation by permitting the photographer toselect color data according to the specific color of the subject and seta desired weighting for each color data. For example, the color of ahuman face is not prone to be affected by other colors, although it hasa relatively low contrast. In such a case, according to the presentembodiment, it is possible to select color data or brightness data withthe skin color being defined as a specific color and place a greatweight only on the skin color when processing the evaluated values.

When taking a picture that includes flowers, should a photographerwishing to focus on the petals of a flower use only brightness data inthe evaluation process, this may cause green leaves surrounding theflower petals to be erroneously detected as a peak of evaluated values,resulting in a failure to focus on the flower petals. The presentembodiment is free from such a problem; in cases the flower petal are,for example, blue, using only blue color data for the evaluation processenables the focusing device to reliably recognize the flower petals asthe targeted subject, ensuring reliable focusing on the blue petals evenif it is outdoor shooting which is susceptible to subject shaking due towind or other causes. As a photographing mode for calculating a focallength by using only image data that consists of color data of aspecific color based on a subject is thus provided, using only the imagedata that consists of the color data of a specific color ensures easyfocusing on a subject on which the operator intends to focus on withoutbeing affected by other color data.

The present embodiment is provided with a brightness detecting circuit,auxiliary light sources L1,L2, and light source circuits 43,44 forrespectively controlling the auxiliary light sources L1,L2. Thebrightness detecting circuit consists of the CPU 17 and other componentsand serves to measure brightness. The auxiliary light sources L1,L2 area plurality of light sources adapted to support, based on brightness,photographing of images to obtain data for focal length detection. Withthe structure as above, control of light emission from the auxiliarylight sources L1,L2 (See Steps 1406, 1407, 1410, 1412 and 1414 in FIG.14) and weighting calculation (See Steps 1408, 1409, 1411, 1413 and 1415in FIG. 14) are performed based on brightness data or color data (SeeSteps 1403 and 1404 in FIG. 14).

Furthermore, the embodiment includes what may be called a selectivecontrol enabling circuit (See the light source circuits 43,44 and theswitches 45,46 in FIG. 2) for selecting any one or a plurality of lightsources from among the auxiliary light sources L1,L2 and causing theselected auxiliary light source(s) L1,L2 to emit light simultaneously.

An auxiliary light determining means to make selection of auxiliarylight sources L1,L2 is provided with a selecting means to control theauxiliary light sources L1,L2 either automatically or manually.

When selecting auxiliary light sources L1,L2 manually (See Step 1402 inFIG. 14), it is possible to perform weighting calculation (See Steps1408, 1409, 1411, 1413 and 1415 in FIG. 14) based on color data of thelight beams from the plurality of light sources L1,L2 (See Steps 1406,1407, 1410, 1412 and 1414 in FIG. 14).

As described above, a plurality of auxiliary light sources L1,L2 areprovided to support focusing. Therefore, even when photographing isperformed in low-light conditions, the optimum focusing is ensured byusing the auxiliary light sources L1,L2 so as to select the optimumimage data from among multiple image data based on color temperaturesand other characteristics of light from the auxiliary light sourcesL1,L2 and use the selected data for weighting calculation.

In other words, as the embodiment described above includes at least oneauxiliary light source L1,L2, which is a light source to be used forfocusing, and uses the auxiliary light source(s) L1,L2 for weightingevaluated values by causing the auxiliary light source(s) L1,L2 havingthe optimum color data of these auxiliary light sources L1,L2 to emitlight and selecting color data based on color temperatures or otherfeatures of the auxiliary light sources L1,L2. Therefore, the embodimentenables accurate focusing while effectively using the auxiliary lightsource(s) L1,L2. For example, when a red (R) light emitting diode (LED)is used as an auxiliary light source L1,L2, obtaining evaluated valuesfrom red color image data and giving a greater weight to red color dataso that the auxiliary light reaches a farther distance at a lower costthan in a case where another color is used. As a result, accuratefocusing is ensured even on a subject situated in a dark environment.

In cases where a plurality of auxiliary light sources L1,L2 areprovided, the possibility of accurate focusing can be increased byselecting the auxiliary light source(s) L1,L2 to emit light based onfeatures of the subject. For example, if three auxiliary light sourcesL1,L2,L3 (not shown) are provided and these auxiliary light sourcesL1,L2,L3 emit light beams of red, blue and green colors respectively, itis effective to select based on the color data of the subject theauxiliary light source L1,L2,L3 for emitting light of the color that isdeemed to produce the most effective evaluated value and cause theselected auxiliary light source L1,L2,L3 to emit light.

With the configuration as above, wherein one or more auxiliary lightsources L1,L2 to emit light can be selected manually or automatically,the photographer can choose the optimum auxiliary light source L1,L2based on conditions of the subject manually if he has knowledge ofauxiliary light sources or automatically if he lacks such knowledge. Ineither way, the light source the most appropriate for the subject can beeasily used for focusing.

Although the present embodiment described above uses RGB-type image dataor YCC brightness data as information for obtaining evaluated valuesfrom image signals, it is also possible to generate image data of aspecific color or color data in the form of CMY color differenceconsisting of cyan (C), magenta (M) and yellow (Y) by means of thematrix complementary circuit 27 shown in FIG. 2 and use the generatedimage data for processing. By using appropriate weight variables setbased on information of these colors, an accurate focal length can bedetected.

Furthermore, the present embodiment enables focusing to the long rangeside according to the intention of the photographer and therebyfacilitates image capturing focused to the long range side as intendedby the photographer. To be more specific, based on the range ofphotographing distance, the photographer can choose either the so-callednormal mode or the mode aimed at far distance photography, e.g. the fardistance mode or the infinity mode, or, based on a constitution whichenables the lens to be focused at any distance within the entire rangeof photographing distance for which the lens is designed, choose themode that gives priority to either a short distance or a far distance.As a result of this feature, the photographer can take desired pictureseasily. As a focusing position is determined using data which has beenobtained from a plurality of image areas and ascertained to be free fromany undesirable influence of sudden movement of the subject or the like,in other words data which has been judged to be valid for focusing,pictures can be taken that exactly meet the photographer's expectations.With the features as above, the present embodiment provides a method ofautomatic focusing which calls for dividing a frame into a plurality ofareas and determining a focusing position in each area. Even with ascene containing an obstruction to range finding, such as movement ofthe subject or camera shake, the method according to the embodiment iscapable of appropriate range finding and focusing of the optical system11 by detecting blur and using only the optimal data, and, therefore iscapable of increasing the accuracy of focusing.

Giving priority to the short range when calculating a plurality of focallengths in a plurality of areas and determining a final focal length isa method generally deemed effective. However, should there be anerroneous peak at a distance shorter than the subject distance due tomovement of the subject or camera shake, giving priority to the shortrange through a conventional process may prevent the subject from beingrecognized as the focusing position and, instead, cause the erroneouspeak to be determined as the focusing position, resulting in failure insetting the correct focusing position. When taking a picture of asubject located at a far distance rather than at a short distance, it ispossible in this case too that movement of the subject or camera shakemay cause an erroneous peak to be mistaken for the focusing position;the focusing position may be erroneously set at a peak located closerthan the real peak or at a peak located even farther than the fardistance intended by the photographer (for example, a position fartherthan the subject that is located farthest in the captured image). Ineither case, focusing is not done as the photographer intended. However,even if movement of the subject or camera shake generates an erroneouspeak at a location closer or farther than the subject distance, theembodiment enables the reliable setting of an appropriate focusingposition by detecting the movement of the subject or camera shake andusing only the correct evaluated values while giving priority to theshort range or long range based on the selected photographing mode.

In cases where the range of photographing distance is set at the normalmode, the shortest-distance selecting mode is automatically selected. Incases where the range of photographing distance is set at the fardistance mode, the longest-distance selecting mode is automaticallyselected. As the subject at the longest distance is selected for thefinal focusing position from among a plurality of image areas withoutthe shortest distance in the range of photographing distance set by thelong-distance mode being erroneously selected as the final focusingposition, pictures can be taken as desired by the photographer.

In cases where the configuration of the device permits mode selectionbetween the long-range priority mode and the short-range priority modefrom within the entire range of photographing distance, it is sufficientfor the photographer to simply choose the long-range priority mode;there is no need of complicated operation by the photographer tovisually determine the photographing range (for example, whether thesubject is in the macro range or the normal range) beforehand. Togetherwith accurate focusing that calls for determining the final focal lengthafter evaluating the reliability of the data, the embodiment enablesaccurately focused photography that meets the photographer's intention.

Furthermore, the use of the long-range priority mode also enablesaccurate focusing to a far distance other than the infinity.

As the method described above calls for calculating and evaluating thedistance to the subject in each one of plural areas, it prevents failurein focusing even if the subject has moved or background blur hasoccurred. Furthermore, even under severe conditions that impair accurateevaluation of the focusing positions, such as when range finding isimpossible because contrast evaluated values are too low in all theimage areas to produce valid focusing positions, pictures can be takenas desired by the photographer by designating a given distance as thefocusing distance based on the photographing mode.

As the present embodiment calls for meeting the photographer'sintention, which has been made clear by the selection betweenshort-range priority and long-range priority, the embodiment enables theintuitive confirmation of the focal length prior to an actualphotographing action without using complicated algorithms and eliminatesthe necessity of a special device, such as an optical finder of asingle-lens reflex camera or a device that uses a calculation componentand serves for enlarged display on an LCD panel. Therefore, comparedwith a conventional device including a mechanism that permits the camerato automatically recognize the focal length in an image by using alearning function as well as the selection between short-range priorityand long-range priority in order to determine the focal length, theembodiment offers a device having a simplified structure at reducedproduction costs.

The driving range of the lens varies with respect to the range ofphotographing distance for which the lens is designed, depending onfluctuation resulting from the lens magnification, a change resultingfrom a change in aperture, as well as temperature, position and otherconditions of the lens barrel, which supports the lens. Therefore,taking into consideration the degree of change resulting from changes inthese various conditions in addition to the driving range calculatedfrom the range within which the lens is designed to be focused, theoptical system 11 is provided with overstroke ranges at the short-rangeend and the long-range end respectively. An overstroke range is a rangein which the lens is permitted to move by the distance corresponding tothe degree of change. Furthermore, the control means, which is comprisedof the CPU 17 or the like, is adapted to be capable of driving the lensposition of the focus lens unit into an overstroke area.

With the structure as above, in the longest-distance selected mode, evenif the in-focus position is near the long-range end of the lens drivingrange and the lens barrel is oriented towards the far distance side, therange of photographing distance is ensured by driving the lens of thefocus lens unit into the overstroke area at the long-distance end.

Furthermore, in the shortest-distance selected mode, even if thein-focus position is near the short-range end of the lens driving rangeand the lens barrel is oriented towards the shortest distance side, therange of photographing distance is ensured by driving the lens of thefocus lens unit into the overstroke area at the short-distance end.

As described above, the embodiment enables the photography with possibledeviation of the focal point occurring near the short-range end orlong-range end taken into consideration, thereby easily ensuring therange of photographing distance without the need for a means of control,mechanical or software, for high precision distance correction.Therefore, the embodiment enables reduced production costs.

According to the present embodiment, the photographer may freely set therange of photographing distance and select the long-range priority mode.However, the structure and operation of the device may be simplified bya constitution that permits only one of the two types of selection, i.e.selection of the range of photographing distance or selection of thelong-range priority mode.

As described above, according to a method of detecting a focal length ofthe present embodiment, the focal length is selected from among thepartial focal lengths in the image detecting areas, either the partialfocal length at the shortest distance or the partial focal length at thelongest distance, in accordance with the operator's choice. The methodhaving this feature enables the selection of an accurate focal lengthbetween the shortest focal length and the longest focal length, inaccordance with the intention of the operator.

According to a method of detecting a focal length of the presentembodiment, a control means selects as the focal length either thepartial focal length at the shortest distance or the partial focallength at the longest distance from among the partial focal lengths inthe image detecting areas in accordance with the operator's selection ofthe range of photographing distance. As the control means selects as thefocal length either the partial focal length at the shortest distance orthe partial focal length at the longest distance from among the partialfocal lengths in the image detecting areas in accordance with theoperator's selection of the range of photographing distance, the methodhaving this feature enables the selection of an accurate focal length inaccordance with the intention of the operator.

According to a method of detecting a focal length of the presentembodiment, the focal length is selected based on the reliabilitybetween a partial focal length selected from among the partial focallengths in the image detecting areas and a given focal length. Themethod having this feature is based on a method of selecting a focallength from partial focal lengths having a high reliability, and enablesthe selection of an accurate focal length. Should there be no partialfocal length having a high reliability or all the partial focal lengthshave a low reliability, a preset focal length is used so as to preventselection of an inaccurate focal length.

According to a method of detecting a focal length of the presentembodiment, the focal length is selected, based on the reliability,between a partial focal length selected from among the partial focallengths in the image detecting areas and a given focal length that hasbeen set as a result of the operator's choice. The method having thisfeature is based on a method of selecting a focal length from partialfocal lengths having a high reliability, and enables the selection of anaccurate focal length between the short distance and the far distance inaccordance with the intention of the operator. Should there be nopartial focal length having a high reliability or all the partial focallengths have a low reliability, a preset focal length that correspondsto the operator's choice is used so as to prevent selection of aninaccurate focal length, while reflecting the intention of the operator.

A focusing device according to the present embodiment is provided with aphotographing mode selecting means adapted to make selection between ashort-distance priority mode and a long-distance priority mode, and theimage processing means of the focusing device is adapted to select thefocal length with priority given to either the partial focal length atthe shortest distance or the partial focal length at the longestdistance in accordance with the result of operation of the photographingmode selecting means. The device having this feature enables theselection of an accurate focal length between the short distance and thefar distance, in accordance with the intention of the operator. As thedevice is capable of performing this function without complicating itsstructure, production costs can be kept under control.

A focusing device according to the present embodiment has an opticalsystem driving means that is capable of driving the optical system intoan overstroke range, which is a range beyond the range of focal lengthfor which the optical system is designed. The device having this featureenables easy and accurate focusing at a short distance or a far distanceregardless of deviation of the focal point of the optical systemresulting from temperature, orientation of the optical system or otherconditions.

An image capturing apparatus according to another embodiment of theinvention is explained hereunder, referring to FIGS. 17 through 19.

While being based on the constitution described above, the presentembodiment involves focus bracket photography, which calls for thephotographer to use color data of a plurality of colors generated fromimage data for calculation of different partial focal lengths forrespective color data and take pictures at the respective calculatedpartial focal lengths. As a prerequisite, bracket photography accordingto the present embodiment includes the following steps or processes inselection of the photographing modes (Step 11) shown in FIG. 12:calculation of partial focal lengths by using color data within thescope that corresponds to the range of photographing distance selectedin Step 1201, selection of the photographing modes (Step 1310) includedin image signal determining processing shown in FIG. 13, and variouscontrol processes, such as control of whether or which of the auxiliarylight sources L1,L2 to be caused to emit light and employing acombination of a plurality of photographing modes.

First, S1 sequence, which is a sequence for photographing a still image,is explained, referring to a flow chart shown in FIG. 17. In the S1sequence, the shutter button is in a half-depressed state. First,judgment is made as to whether the photographer has already madeselection of bracket photography (Step 1701). In cases where bracketphotography has been selected, the variable BL_FLG is set at 1(BL_FLG=1) (Step 1702). In cases where bracket photography has not beenselected, the variable BL FLG is set at 0 (BL_FLG=0) (Step 1703). Thevariable BL_FLG is used for determining in a later step whether or notbracket photography is going to be performed. Then, exposure processingis performed (Step 1704). The objective of the exposure processing is todetermine control criteria to achieve appropriate exposure with regardto a subject. The exposure processing primarily consists of setting theshutter speed, the aperture and the gain of the CCD 12 which serves asan image pickup device.

Next, focusing processing is performed (Step 1705). First, details offocusing processing to be performed in cases where use of auxiliarylight has not been set is explained in detail, referring to primarilyFIG. 18. In FIG. 18, the process from Step 11 to Step 106 is conductedin the same manner as that shown in FIG. 11. In Step 111 for calculatingreliability of each window, the amount of the weight Window(Wh) (CNB) tobe placed on the reliability of each color data is calculated (Step 322)as shown in FIG. 15. After the process in Steps 112-114 shown in FIG. 18is completed, weighting calculation for the evaluated value of eachcolor data is performed (Step 115) in the same manner as the processshown in FIG. 7. Then, after the process in Steps 116-120, focusingdistance calculation is performed based on the calculated evaluatedvalues (Step 121). If the result of focusing distance determination isOK (Step 122), the current state of the focal length, i.e. the focuslens position P(CNB), is stored (Step 125). If the result of focusingdistance determination is NG (Step 122), a given focal length which hasbeen set beforehand, i.e. a preset focus lens position P(CNB), is stored(Step 126). CNB mentioned above represents the number of color dataitems. For example, in cases where three colors consisting of R (red), B(blue) and G (green) are used, CNB is set as 3 so that three focallengths are calculated. When calculation of all the focal lengths iscompleted (Step 127), the processing returns to the flow chart shown inFIG. 17. In other words, when the focusing processing (Step 1705)described above is completed, the focus lens position corresponding toeach respective color data has been calculated.

In cases where the variable BL_FLG is 0 (Step 1706) in the flow chartshown in FIG. 17, the procedure shifts to determination as to whetheractual photography should be performed (Step 1711). In cases where thevariable BL_FLG is 1 (Step 1706), the calculated focus lens positionsP(CNB) are rearranged sequentially from the shortest focal length (Step1707), and the lens of the optical system 11 is moved to the closestfocus lens position P(CNB) (Step 1708). In other words, the lens ismoved to an end of the linking range as the initial setting in order toperform photographing in succession at a plurality of focus lenspositions P (CNB). Therefore, although the calculated focus lenspositions P(CNB) are rearranged sequentially from the shortest focallength so that images are photographed in sequence from the shortestfocal length, the calculated focus lens positions P(CNB) may berearranged sequentially from the longest focal length to photographimages in sequence from the farthest distance.

As the next step in the focusing processing in Step 1705, whether or notuse of auxiliary light has been selected (See Step 1311 in FIG. 13) isdetermined by the auxiliary light determining means or the like (Step1709). In cases where a single auxiliary light source is going to beused (Step 1710), the procedure shifts to whether or not to photograph(Step 1711) In cases where a plurality of auxiliary light sources aregoing to be used (Step 1710), focusing processing is performed for everycombination of the auxiliary light sources to be used so as to calculateeach respective focus lens position P(CNB) (Step 1710).

After the lens movement described above, the shutter button is depressedso that, in cases where still-image photography is enabled (Step 1711),photographing processing (Step 1712) is initiated. The system is at astandstill until the photographing processing is completed (Step 1713).After the photographing processing is completed, judgment is made as towhether a specified number of images has been photographed (Step 1714).

In cases where a single auxiliary light source is used, the number ofimages taken by bracket photography is CNB. Should it be found in Step1714 that photographing of a specified number of images has not beencompleted, the specified number on a counter is reduced by one (−1)(Step 1716). Thereafter, the lens is moved to a focus lens position P(CNB) for a location farther than that for the current lens position(Step 1717). Thus, until the specified number (CNB) of frames ofphotographs are taken, lens moving and photographing actions arerepeated (Steps 1711-1717).

It is thus possible to perform bracket photography, which refers tosuccessive photographing actions at different focal lengths, can beperformed by using the partial focal lengths for the image detectingareas obtained for each color data.

The S1 sequence described above is primarily for conducting exposureprocessing (Step 1707) and focusing processing (Step 1708) in a sequencethroughout which the shutter button is in the half-depressed state. Inthe state where the shutter button is fully depressed(Step 1711),photographing processing (Step 1712), i.e. an actual bracketphotographing action to take still images, is performed (Step 1712).When the shutter button is not in the fully-depressed state (Step 1711)or the specified number of images have been photographed (Step 1715),the S1 sequence is terminated (Step 1715).

Although it is not shown in the drawings, in cases where the S1 sequencehas been terminated and the shutter button is in the half-depressedstate, the data on the focus lens positions P(CNB) is maintained untilthe shutter button is fully depressed again. Therefore, bracketphotography can be performed by depressing the shutter button further tothe fully-depressed position.

In cases where still-image photography was not enabled in Step 1711, thelens is set at a given position which is appropriate for thephotographing mode and selected from among the focal lengths calculatedfor the respective color data.

When the photographing processing (Step 1712) for bracket photography isinitiated, a warning is displayed on the image display unit 21indicating the initiation of bracket photography. This warning may bedisplayed until the first photographing processing is completed (Step1713) or until the entire S1 sequence is completed (Step 1713). By thusnotifying the photographer that bracket photography is taking place, thephotographer is prevented from moving the image capturing apparatus 10away from the subject during a photographing action. Although it is notshown in the drawings, the image capturing apparatus 10 may be providedwith an audio means, such as speakers, so as to sound a warning at thesame moment as the displayed alert. Such an audio warning may beemployed together with or instead of a warning display.

As described above, by performing bracket photography at optimumfocusing positions for respective color signals, in other words by meansof a focusing device that enables bracket photography at optimumfocusing positions for respective color signals, which have beenobtained by applying weighting calculation to the contrast evaluatedvalues of the respective color data contained in the signalsrepresenting each image, the present embodiment increases thepossibility of capturing an image for which the lens is correctlyfocused for a subject on which the photographer intends to focus.

To be more specific, the present embodiment offers calculationprocessing which includes a means to detect contrast values ofrespective image data, i.e. image signals, obtained through at least twodifferent color filters (See the matrix complementary circuit 27) andhas a function of performing focusing processing for each one of theseimage signals in the same manner as in the case of the constitutiondescribed above and shown in FIGS. 1 through 16. The calculationprocessing further includes a means to make selection from among saidimage signals and apply calculation processing to the selected imagesignal(s) (See the matrix complementary circuit 27, the switch 28 andthe Step 12 in FIG. 18) as well as a means to have the lens focus on asubject by applying weighting calculation to the evaluated values of therespective image data obtained by the aforementioned means to performselection and calculation. The present embodiment also includes abracket photographing mode (See FIG. 17, which comprises steps ofsetting a plurality of image detecting areas in each one of the multipleimage data, calculating the amount of the weight of reliability of eachevaluated value that has been obtained for each image detecting area(See Steps 319-322 in FIG. 15), selecting a given focal length for eachoutput color data from among partial focal lengths in each respectiveimage detecting area based on the evaluated values (See Step 115 in FIG.7 and Step 115 in FIG. 18) of the partial focal lengths and the employedphotographing mode (See Step 11 in FIG. 18), storing distanceinformation for the color data of each respective color (See Steps 125and 126 in FIG. 18), and taking a plurality of photographs sequentiallyat the respective partial focal lengths.

By thus including a means to calculate given focal lengths that areappropriate for the photographing mode from partial focal lengthscalculated for the respective image data generated from the data of theinitial photographed image (See Step 12 in FIG. 18) and to takephotographs sequentially at the calculated focal lengths respectively,the present embodiment enables photography at a focusing positionappropriate for features of the subject without having to be concernedwith possible deviation of the focal point resulting from a minutedifference in colors of the subject.

In other words, in a method or a device for calculating a plurality offocal lengths by using a plurality of image detecting areas and decidingthe final focal length from among the calculated focal lengths, partialfocal lengths are calculated from multiple image data containinginformation of different colors. Therefore, by calculating the optimumpartial focal lengths for the respective color image data and performingbracket photography based on these partial focal lengths, the presentembodiment enables the photographer to obtain an optimum image with asingle photographing. According to the present embodiment, whereas themanual mode makes it possible to give evaluated values different weightsbased on color data of different colors, thereby enabling bracketphotography performed exactly as the photographer desires by means ofsetting of the photographing mode or other criteria, the automatic modemakes it possible to determine characteristics of the color data of thesubject by automatically confirming white balance, color data of lightemitted from auxiliary light sources, etc., and apply weighting toevaluated values accordingly so as to achieve easy and accuratefocusing.

When using a conventional focusing device which uses only one type ofdata, i.e. brightness data or color data of a single color, there may beoccasions where the device is unable to detect contrast even if thecontrast is recognizable to the human eye because of color data. Such afailure in recognition of contrast often occurs when the parts of thepatterns that constitute the subject to be photographed have the samebrightness. In the case of the present embodiment, however, particularlyin low-light condition or when movement of the subject or camera shakeis occurring, the aforementioned use of multiple image data containinginformation of different colors enables the photographer to take aseries of photographs with a single photographing action at the optimumpartial focal lengths for the respective color data. Therefore, even ifthe photographer does not have sufficient knowledge of color data, it ispossible to photograph an accurately focused subject for which focusinghad been difficult for a conventional AF device.

When taking a picture that includes, for example, a flower, should thephotographer wishing to focus on the petals of a flower use onlybrightness data in the evaluation process, this may cause green leavessurrounding the flower to be erroneously detected as a peak of evaluatedvalues, resulting in a failure to focus on the flower petals. Thepresent embodiment is free from such a problem because partial focallengths can be calculated from more appropriate data, such as colordata; for example, photographing can be performed by focusing on flowerpetals of a specific color by detecting the partial focal length for thecolor data corresponding to the color of the flower petals. Furthermore,should there be flowers of different colors, images that include anoptimally focused image can be captured by taking a series ofphotographs focused on the flower petals of the respective flowers witha single photographing action.

Furthermore, it is possible to prevent the photographer from moving theimage capturing apparatus 10 in the course of bracket photography byproviding the image capturing apparatus with a warning means fornotifying the photographer that bracket photography is taking placeduring or at the beginning of bracket photography. The warning means mayuse the image display unit 21 to visually display that bracketphotography is underway or, either instead of or together with thevisual display, use an audio means (not shown) to indicate bracketphotography operation by voice or other sound.

Although the explanation of the embodiment shown in FIG. 17 pertainsonly to whether or not auxiliary light is used as a photographing, theinvention is not limited to such a constitution; it is also possible toprovide a bracket photography mode which permits selection of aplurality of photographing modes (See Step 11 in FIG. 12) and take aseries of photographs in each photographing mode at a plurality ofpartial focal lengths based on contrast evaluated values of multipleimage data respectively obtained from information of different colors.

For example, instead of auxiliary light processing shown in Steps1709,1710 in FIG. 17, procedures in Steps 1709,1710 shown in FIG. 19 maybe followed. To be more specific, after the calculated focus lenspositions P(CNB) are rearranged sequentially from the shortest focallength (Step 1707) and the lens of the optical system 11 is moved to theclosest focus lens position P(CNB) (Step 1708), confirmation is made(Step 1709) as to the photographing mode(s) to be employed (See Step1310 in FIG. 13) in the focusing processing in Step 1705. In cases wherea single photographing mode is going to be used (Step 1710), theprocedure shifts to determination of photographing (Step 1711). In caseswhere a plurality of photographing modes are going to be used (Step1710), focusing processing is performed for each one of thephotographing modes to be used so as to calculate each respective focuslens position P(CNB) (Step 1710).

In the same manner as in the processes shown in FIG. 17, after the lensmovement described above, the shutter button is depressed so that, incases where still-image photography has been enabled (Step 1711),photographing processing (Step 1712) is initiated. The system is at astandstill until the photographing processing is completed (Step 1713).After the photographing processing is completed, judgment is made as towhether a specified number of images have been photographed (Step 1714).

In cases where a single auxiliary light source is used, the number ofimages taken by the bracket photography is CNB. Should it be found inStep 1714 that photographing of a specified number of images has notbeen completed, the specified number on a counter is reduced by one (−1)(Step 1716). Thereafter, the lens is moved to a focus lens positionP(CNB) for a location farther than that for the current lens position(Step 1717). Thus, until the specified number (CNB) of frames ofphotographs are taken, lens moving and photographing actions arerepeated (Steps 1711-1717).

It is thus possible to perform bracket photography, which refers tosuccessive photographing actions at different focal lengths, can beperformed by using the partial focal lengths for the image detectingareas obtained for each color data.

The present invention is applicable to various image capturingapparatuses, including, but not limited to, digital cameras and videocameras.

Having described preferred embodiments of the invention with referenceto the accompanying drawings, it is to be understood that the inventionis not limited to those precise embodiments, and that various changesand modifications may be effected therein by one skilled in the artwithout departing from the scope or spirit of the invention as definedin the appended claims.

1. A method of detecting a focal length which calls for: obtaining,while changing the focal length of an optical system, multiple imagedata selected from among image data consisting of brightness data and aplurality of color data; and calculating a focal length from theobtained multiple image data by using the peak value of contrastevaluated values of said multiple image data.
 2. A method of detecting afocal length as claimed in claim 1, wherein: weighting of the evaluatedvalues of each image data of each respective color data that has beenselected is automatically performed based on conditions set for saideach image data.
 3. A method of detecting a focal length as claimed inclaim 1, wherein: the operator performs by the operator's discretionweighting of the evaluated values of each image data of each respectivecolor data that has been selected.
 4. A method of detecting a focallength as claimed in claim 1, wherein: a photographing mode forcalculating a focal length by using only image data that consists ofcolor data of a specific color selected based on a subject is provided.5. A method of detecting a focal length as claimed in any one of theclaims from claim 1 to claim 4, wherein: auxiliary light with givencolor data is emitted when the image data is obtained, and weighting ofthe evaluated values of the color image data is performed based on thecolor data of the emitted auxiliary light.
 6. A method of detecting afocal length as claimed in any one of the claims from claim 1 to claim5, wherein: the method calls for setting a plurality of image detectingareas adjacent to one another in each one of the obtained multiple imagedata, calculating a partial focal length for each image detecting areabased on which image data the peak value of contrast evaluated valueshas been recorded in, calculating the reliability of each imagedetecting area based on the position at which said peak value has beenrecorded moving across the multiple image data, and selecting a focallength from a group consisting of said partial focal lengths and atleast one given focal length, said focal length selected based on thereliability and the evaluated values of each respective image detectingarea.
 7. A focusing device including: an image pickup device, an opticalsystem for forming an image on said image pickup device, an opticalsystem driving means for changing the focal length of said opticalsystem, and an image processing means for processing image data outputfrom said image pickup device and controlling said optical systemdriving means, wherein: the image processing means is adapted to: whilechanging the focal length of said optical system, obtain multiple imagedata selected from among image data of brightness data and a pluralityof color data, and calculate a focal length from the obtained multipleimage data by using the peak value of contrast evaluated values of saidmultiple image data.
 8. A focusing device as claimed in claim 7,wherein: the focusing device is provided with an operating means whichenables the operator to perform by the operator's discretion weightingof the evaluated values of each image data of each respective color datathat has been selected.
 9. A focusing device as claimed in claim 7,wherein: the image processing means is adapted to automatically performweighting of the evaluated values of each image data of each respectivecolor data that has been selected based on conditions set for said eachimage data.
 10. A focusing device as claimed in any one of the claimsfrom claim 7 to claim 9, wherein: the focusing device is provided withan auxiliary light device for emitting light with given color data. 11.A focusing device as claimed in any one of the claims from claim 7 toclaim 10, wherein: the image processing means is adapted to: set aplurality of image detecting areas adjacent to one another in each oneof the obtained multiple image data, calculate a partial focal lengthfor each image detecting area based on which image data the peak valueof contrast evaluated values has been recorded in, calculate thereliability of each image detecting area based on the position at whichsaid peak value has been recorded moving across the multiple image data,and select a focal length from a group consisting of said partial focallengths and at least one given focal length, said focal length selectedbased on the reliability and the evaluated values of each respectiveimage detecting area.
 12. An image capturing method which calls for:using color data of a plurality of colors to detect a focal length foreach respective color data and capturing an image at each focal lengthdetected for each respective color data.
 13. An image capturing methodas claimed in claim 12, wherein: a plurality of photographing modes canbe selected, and should a plurality of photographing modes besimultaneously selected, focal lengths are detected for each one of theselected photographing modes by using color data of a plurality ofcolors, and images are captured at the respected focal lengths that havebeen detected.
 14. An image capturing method as claimed in claim 12 orclaim 13, wherein: focal length detection calls for: obtaining aplurality of image data of each respective color data while changing thefocal length of an optical system, setting a plurality of imagedetecting areas adjacent to one another for the image data of each colordata, calculating a partial focal length for each image detecting areabased on which image data the peak value of contrast evaluated valueshas been recorded in, calculating the reliability of each imagedetecting area based on the position at which said peak value has beenrecorded moving across the multiple image data, and selecting a focallength from a group consisting of said partial focal lengths and atleast one given focal length, said focal length selected based on thereliability and the evaluated values of each respective image detectingarea.
 15. An image capturing apparatus including: an image pickupdevice, an optical system for forming an image on said image pickupdevice, an optical system driving means for changing the focal length ofsaid optical system, and an image processing means for processing imagedata output from said image pickup device and controlling said opticalsystem driving means, wherein: the image processing means is adapted to:obtain a plurality of image data of each respective color data whilechanging the focal length of said optical system, and calculate a focallength for each respective color data mentioned above by using the peakvalue of contrast evaluated values calculated from the obtained multipleimage data, and perform image capturing at each focal length calculatedfor each respective color data.
 16. An image capturing apparatus asclaimed in claim 15, wherein: the apparatus is provided with a warningmeans for indicating that image capturing is underway.